none
SOAP service on Java returns incorrect types in Response. RRS feed

  • Question

  • I use a third-party server written in Java.
    WSDL is taken with the style of rpc/literal.

    Connection to the service is initialized as follows:

    private static MLPortChannel GetMerlionClient()
    {
                BasicHttpsBinding binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport);
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
                binding.MaxReceivedMessageSize = 4096000;
    
                EndpointAddress adress = new EndpointAddress(new Uri(@"https://apitest.merlion.com/rl/mlservice3"));
    
                ChannelFactory<MLPortChannel> factory = new ChannelFactory<MLPortChannel>(binding, adress);
                factory.Credentials.UserName.UserName = mlLogin;
                factory.Credentials.UserName.Password = mlPassword;
    
                return factory.CreateChannel();
    }

    It is works correctly only for one method and returns the correct data type and the data.

    When I call other methods, they returns error as:
    "Can not convert an object of type " ... MLService3RLTest.CatalogResult [] " of the type " ... MLService3RLTest.ShipmentDatesResult []"

    In this example return type must be ShipmentDatesResult[].

    I tested the service via special tool. All requests and responses is correct and returned correct XML.

    What may be the cause of this error? Perhaps something needs to be configured for SOAP service. Maybe some magic option with right value?


    Tuesday, December 22, 2015 1:05 PM

All replies

  • Hi Sergey Filatov,

    According to this case, as far as I know, when we consume the JAVA WEB Service via C# client.

    If the C# client can not recognize the class type of java web service. For example, DateTime(C#)

    and Date Classes(Java). That is the different  class type. So, it will cause the serialization and

    deserialization error. So, I suggest you need to make sure the client and server-side have the

    same class type.

    Also, you can  override in a C# sub class.

    For more information, please refer to the following articles:

    1.Consuming a Java Web Service with a .NET Client

    I hope that will be helpful to you.

    Best Regards,

    Wanjun Dong

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Wednesday, December 23, 2015 2:38 AM
    Moderator
  • Wanjun Dong, unfortunately this is different problem.

    Service returns only simple strings and digital types in classes. One method works correct and returns correct class with correct data type (properties as strings, int, float and ect.). All other methods returns error of convertation.


    Wednesday, December 23, 2015 9:46 AM
  • Hi sergey Filatov,

    Could you share a  repro project about this issue on onedrive, it will help us to

    reproduce your issue and troubleshooting it.

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, December 28, 2015 5:48 AM
    Moderator