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="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>
Questions:
- Am I calling the Java Web Service correctly?
- How would I view the XML error being returned?
- Am I better off using a Web Reference or the WebRequest/HttpWebRequest to connect to this Java Web Service?
You could use a tool like Fiddler to inspect the request/response that you are sending from code and then compare that to the successful request that you send with SoapUI.