簡體   English   中英

.NET客戶端構造的SOAP具有有效對象,Java客戶端SOAP具有空對象

[英]SOAP constructed by .NET client has valid object, Java client SOAP has null object

我在與.NET Web服務通信的Java客戶端下構造的SOAP遇到麻煩。 我也有一個用於測試目的的.NET客戶端,使用此客戶端,我沒有任何問題。

您能幫我找出問題所在嗎?

SOAP 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的exportData可以容納所有數據。

有人可以幫我嗎?

昨天我在解決類似的問題。 最終發現合約接口中的參數名稱與客戶端傳遞的名稱不匹配。 但是,查看您的請求,我發現Java客戶端和.net客戶端之間沒有任何名稱差異。

您的界面是什么樣的?

我通過將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>
...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM