我剛剛在Visual Studio中使用服務引用,並試圖使用Java Web服務。我已經使用嚮導添加了服務引用。該向導構建了代理代碼並將端點添加到配置文件。從服務調用引用到Java Web Service什麼也沒有返回
Java端點將自定義類型作爲單個參數。我通過代理對象填充了對象,並將其傳遞給服務。但是當我查看響應對象時,所有的屬性都是空的。沒有錯誤被拋出。請注意,當我使用soapUI時,我可以編輯併發送XML到服務併成功獲得響應。如果發生錯誤,我可以查看在soapUI中發回的XML錯誤消息。
下面是調用代碼:
static void CallJavaEndPoint()
{
IFX_ProductInqRq inqRQ = new IFX_ProductInqRq();
IFX_ProductInqRqCatSvcRq[] CatSvcRqCollection = new IFX_ProductInqRqCatSvcRq[1];
IFX_ProductInqRqCatSvcRq CatSvcRqItem = new IFX_ProductInqRqCatSvcRq();
IFX_ProductServiceReference.FX_Product_PortTypeClient proxy = new FX_Product_PortTypeClient();
IFX_ProductInqRs response;
// Remove other code for setting properties for brevity
CatSvcRqItem.RequestID = "123456";
CatSvcRqCollection[0] = CatSvcRqItem;
inqRQ.CatSvcRq = CatSvcRqCollection;
// reponse just comes back null, no errors
response = proxy.IFX_CustomerAccountDetailInquiry(inqRQ);
}
從配置文件:
<basicHttpBinding>
<binding name="IFX_Product_Binding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="IFX_Product_Binding1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://example.com/EX_IFXProduct/services/Product_SoapPort_1234"
binding="basicHttpBinding" bindingConfiguration="IFX_Product_Binding"
contract="IFX_ProductServiceReference.IFX_Product_PortType"
name="Product_SoapPort_1234" />
</client>
問題:
- 我是否正確調用Java Web服務?
- 如何查看返回的XML錯誤?
- 我最好使用Web引用或WebRequest/HttpWebRequest連接到此Java Web服務?
嘗試Fiddler,它發送請求,但服務不發送迴應。如果我複製顯示在Fiddler中的XML並在soapUI中使用它,它確實會返回一條消息。我想知道是否需要更改配置信息。 – Josh