我是新来使用服务引用在Visual Studio中,我试图消耗的Java Web服务。我已经使用向导添加服务引用。该向导建立了代理code和添加端点配置文件。
Java的端点需要一个自定义类型的单个参数。我通过代理对象填充对象,并通过在调用该服务。但是,当我看响应对象,所有属性都为空。不会引发错误。请注意,当我使用的soapUI我可以编辑和发送XML的服务,并成功地得到回应。如果出现错误,我可以查看发送回的soapUI的XML错误消息。
下面是调用code:
静态无效CallJavaEndPoint() { IFX_ProductInqRq inqRQ =新IFX_ProductInqRq(); IFX_ProductInqRqCatSvcRq [] CatSvcRqCollection =新IFX_ProductInqRqCatSvcRq [1]; IFX_ProductInqRqCatSvcRq CatSvcRqItem =新IFX_ProductInqRqCatSvcRq(); IFX_ProductServiceReference.FX_Product_PortTypeClient代理=新FX_Product_PortTypeClient(); IFX_ProductInqRs响应; //删除其他code为简洁设置属性 CatSvcRqItem.RequestID =123456; CatSvcRqCollection [0] = CatSvcRqItem; inqRQ.CatSvcRq = CatSvcRqCollection; //效应初探刚回来空,没有错误 响应= proxy.IFX_CustomerAccountDetailInquiry(inqRQ); }
从配置文件:
< basicHttpBinding的> <绑定名称=IFX_Product_BindingcloseTimeout =00:01:00 openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01:00 allowCookies =假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard maxBufferSize =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536 messageEncoding =文本textEncoding =UTF-8transferMode =缓冲 useDefaultWebProxy =真正的> < readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384 maxBytesPerRead =4096maxNameTableCharCount =16384/> <安全模式=运输> <交通运输clientCredentialType =无proxyCredentialType =无 境界=/> <消息clientCredentialType =用户名algorithmSuite =默认/> < /安全> < /装订> <绑定名称=IFX_Product_Binding1closeTimeout =00:01:00 openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01:00 allowCookies =假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard maxBufferSize =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536 messageEncoding =文本textEncoding =UTF-8transferMode =缓冲 useDefaultWebProxy =真正的> < readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384 maxBytesPerRead =4096maxNameTableCharCount =16384/> <安全模式=无> <交通运输clientCredentialType =无proxyCredentialType =无 境界=/> <消息clientCredentialType =用户名algorithmSuite =默认/> < /安全> < /装订> < / basicHttpBinding的> < /绑定> <客户端> <端点地址=https://example/EX_IFXProduct/services/Product_SoapPort_1234 绑定=basicHttpBinding的bindingConfiguration =IFX_Product_Binding 合同=IFX_ProductServiceReference.IFX_Product_PortType NAME =Product_SoapPort_1234/> < /客户>
问题:
什么,你所要做的就是查看生成的Reference.cs文件。会有一对夫妇的不同命名空间属性。当您使用了SoapUI检查响应,你会找到正确的命名空间。替换Reference.cs所有的命名空间的引用文件与已发现的了SoapUI响应的命名空间。
在完成更换的命名空间,你会看到,响应目前连载很好。
请记住,Reference.cs是一个生成的文件,而你失去了改变,当你更新服务引用。
I'm new to using Service Reference in Visual Studio, and I'm trying to consume a Java Web Service. I've added Service Reference using the wizard. The wizard built the proxy code and added endpoints to the config file.
The Java Endpoint takes a custom type as single parameter. I've populated the object via the proxy objects and passed that in the call to the service. But when I look at the response object, all the properties are null. No error is thrown. Note, when I use soapUI I can edit and send XML to the service and successfully get a response. If an error occurs I can view the XML error message sent back in soapUI.
Here is the calling code:
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); }from config file:
<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="example/EX_IFXProduct/services/Product_SoapPort_1234" binding="basicHttpBinding" bindingConfiguration="IFX_Product_Binding" contract="IFX_ProductServiceReference.IFX_Product_PortType" name="Product_SoapPort_1234" /> </client>Questions:
解决方案
What you have to do is review the generated Reference.cs file. There will be a couple of namespace attributes that differs. When you inspect the response using SoapUI you will find the correct namespace. Replace all the namespace references in the Reference.cs file with the namespace you have found in the SoapUI response.
When you finished replacing the namespaces you will see that the response is now serialized well.
Keep in mind that the Reference.cs is a generated file and that you lose the changes when you are updating the service reference.
更多推荐
从呼叫服务引用的Java Web服务没有返回值
发布评论