2

我在与 .NET Web 服务通信的 Java 客户端下构建的 SOAP 遇到问题。我还有一个用于测试目的的 .NET 客户端,使用这个客户端我没有任何问题。

你能帮我找出可能是什么问题吗?

肥皂 JAVA

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns2:exportReferentiel xmlns:ns2="http://www.svad.actoll.com/Svad2BPass/V1.0">
<exportData>
<produit idRechargement="202" libelle="Ticket 10 x 1h individuel" LibelleIhm="Ticket 10x1h ind" ordreTri="10" descriptionLongue="Ticket 10 x 1h individuel" dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00">
    <tarif libelle="202">
    <validiteTarif dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00" valeur="1070" />
    <validiteTarif dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00" valeur="1070" />
    </tarif>
    </produit>
...

上面的 SOAP 有一个 Null 对象

.NET SOAP

<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <exportReferentiel xmlns="http://www.svad.actoll.com/Svad2BPass/V1.0">
      <exportData>
        <produit idRechargement="998" libelle="Teste" LibelleIhm="Teste" ordreTri="98" descriptionLongue="batatinhas" dateDebut="2010-05-10T00:00:00" dateFin="2012-12-31T00:00:00" xmlns="">
          <tarif libelle="998">
            <validiteTarif dateDebut="2010-05-10T00:00:00" dateFin="2012-12-31T00:00:00" valeur="300" />
            <validiteTarif dateDebut="2012-12-31T23:59:59.999" dateFin="2013-12-31T00:00:00" valeur="600" />
          </tarif>
        </produit>
...

网络服务.NET

[WebService(Namespace = "http://www.svad.actoll.com/Svad2BPass/V1.0")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Service : System.Web.Services.WebService, ISvad2BPass
{
    private static bool Debug = false;
[WebMethod]
    [SoapDocumentMethod("http://www.svad.actoll.com/Svad2BPass/V1.0/exportReferentiel")]
    public ExportPassTransBPassStatusType exportReferentiel(ExportPassTransBPassType exportData)
    {
        Debug = bool.Parse(ConfigurationManager.AppSettings["Debug"]);

        Logger.Instance.Log(LogTypeCode.DEBUG, exportData.ToString());

        exportReferentielRequest req = new exportReferentielRequest(exportData);
        return LoadExportPassTransBPass(req);
    }

使用 Java SOAP 的 exportData 变为空,而使用 .NET SOAP 它对所有数据都正常...

谁能帮我解决这个问题?

4

2 回答 2

0

我昨天也遇到了类似的问题。最后发现合约接口中的参数名和客户端传过来的不符。但是查看您的请求,我看不到 Java 客户端和 .net 客户端之间的任何名称差异。

你的界面是什么样的?

于 2012-12-17T14:35:02.637 回答
0

我通过将 ns2 添加到 exportData 标记来解决这个问题。所以这个 SOAP 的正确构造是:

<ns2:exportReferentiel xmlns:ns2="http://www.svad.actoll.com/Svad2BPass/V1.0">
<ns2:exportData>
 <produit idRechargement="202" libelle="Ticket 10 x 1h individuel" LibelleIhm="Ticket 10x1h ind" ordreTri="10" descriptionLongue="Ticket 10 x 1h individuel" dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00">
  <tarif libelle="202">
   <validiteTarif dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00" valeur="1070" />
   <validiteTarif dateDebut="1999-01-01T00:00:00.000+01:00" dateFin="2099-01-01T00:00:00.000+01:00" valeur="1070" />
  </tarif>
 </produit>
...
</ns2:exportData>
...
于 2012-12-18T13:21:13.733 回答