Josh
Josh

Reputation: 8477

Call from Service Reference to Java Web Service returns nothing

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:

  1. Am I calling the Java Web Service correctly?
  2. How would I view the XML error being returned?
  3. Am I better off using a Web Reference or the WebRequest/HttpWebRequest to connect to this Java Web Service?

Upvotes: 1

Views: 898

Answers (2)

Wesley
Wesley

Reputation: 353

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.

Upvotes: 1

granaker
granaker

Reputation: 1328

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.

Upvotes: 1

Related Questions