locked
svcutil and Statefull Tomcat WS no Client serialization RRS feed

  • Question

  • User1179114422 posted

    Hello to the community

    We actually encounter a strange issue.

    We have a Tomcat server that publishes webservice

    Here is the wsdl

    <!--
    Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.3.2 git-revision#3d0bba4.
    -->
    <!--
    Generated by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 2.3.2 git-revision#3d0bba4.
    -->
    <definitions targetNamespace="http://ws.myserver.com/" name="FBrokerService">
    <types>
    <xsd:schema>
    <xsd:import namespace="http://ws.myserver.com/" schemaLocation="http://localhost:9090/WS/FBroker?xsd=1"/>
    </xsd:schema>
    </types>
    <message name="startSession">
    <part name="parameters" element="tns:startSession"/>
    </message>
    <message name="startSessionResponse">
    <part name="parameters" element="tns:startSessionResponse"/>
    </message>
    <portType name="FBroker">
    <operation name="startSession">
    <input wsam:Action="http://ws.myserver.com/FBroker/startSessionRequest" message="tns:startSession"/>
    <output wsam:Action="http://ws.myserver.com/FBroker/startSessionResponse" message="tns:startSessionResponse"/>
    </operation>
    </portType>
    <binding name="FBrokerPortBinding" type="tns:FBroker">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="startSession">
    <soap:operation soapAction=""/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <service name="FBrokerService">
    <port name="FBrokerPort" binding="tns:FBrokerPortBinding">
    <soap:address location="http://localhost:9090/WS/FBroker"/>
    </port>
    </service>
    </definitions>

    But when using the svcutil (or the tools in Visual Studio (2018 2012 2017 and so on) Serialization is ok for the FBrokerService but impossible to get serialization on the FBrokerServiceClient that is also generated. No matter if we put /s or /serialization and other options.

    And of course, when we compile, we get an error on the assembly not marked as serializable.

    If any of you have a clue about this behavior ?

    Thanks a lot

    Friday, May 29, 2020 7:13 AM

All replies

  • User-474980206 posted

    Java can serialize and deserialize more complex objects than c#. Maybe the Xsd is using variants or attributes that svcutil does not support. You will probably have to manually fix the serialization.

    Wednesday, June 3, 2020 2:53 PM
  • User1179114422 posted

    Hello

    Do you got an idea how to fix ? Perhaps fixing the client side ? Or do you think it's java side, because the webservice on jav return a W3CEndpointReference

    Here is the Client part generated by VS / svcutil

    Thanks a lot

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class FBrokerClient : System.ServiceModel.ClientBase<MyApp.FBroker.FBroker>, MyApp.FBroker.FBroker {

    public FBrokerClient() {
    }

    public FBrokerClient(string endpointConfigurationName) :
    base(endpointConfigurationName) {
    }

    public FBrokerClient(string endpointConfigurationName, string remoteAddress) :
    base(endpointConfigurationName, remoteAddress) {
    }

    public FBrokerClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
    base(endpointConfigurationName, remoteAddress) {
    }

    public FBrokerClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
    base(binding, remoteAddress) {
    }

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    MyApp.FBroker.startSessionResponse MyApp.FBroker.FBroker.startSession(MyApp.FBroker.startSessionRequest request) {
    return base.Channel.startSession(request);
    }

    public string startSession() {
    MyApp.FBroker.startSessionRequest inValue = new MyApp.FBroker.startSessionRequest();
    inValue.Body = new MyApp.FBroker.startSessionRequestBody();
    MyApp.FBroker.startSessionResponse retVal = ((MyApp.FBroker.FBroker)(this)).startSession(inValue);
    return retVal.Body.@return;
    }

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    System.Threading.Tasks.Task<MyApp.FBroker.startSessionResponse> MyApp.FBroker.FBroker.startSessionAsync(MyApp.FBroker.startSessionRequest request) {
    return base.Channel.startSessionAsync(request);
    }

    public System.Threading.Tasks.Task<MyApp.FBroker.startSessionResponse> startSessionAsync() {
    MyApp.FBroker.startSessionRequest inValue = new MyApp.FBroker.startSessionRequest();
    inValue.Body = new MyApp.FBroker.startSessionRequestBody();
    return ((MyApp.FBroker.FBroker)(this)).startSessionAsync(inValue);
    }
    }

    Wednesday, June 3, 2020 3:14 PM
  • User-474980206 posted

    your issue is with the xsd import (which you don't show), not the service import.

    as the xsd is referenced as localhost, I assume you are running svcutil on the tomcat server.  the dotnet svcutil is better at importing xsds.

    Wednesday, June 3, 2020 9:24 PM
  • User1179114422 posted

    Hello

    I have try svcutil AND Service References

    But you are right about one thing,  both of them on the same server as Tomcat. If i try to link to my production url for exemple, it's the same with Service References.

    Here is the xsd (of course) : (as you can see, return is a EndpointReferenceType. And i think it's pretty standard, but perhaps....

    <?xml version='1.0' encoding='UTF-8'?>
    <!--
    Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6-1b01 svn-revision#13094.
    -->
    <xs:schema xmlns:tns="http://ws.myserver.com/" xmlns:ns1="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws.myserver.com/">
    <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/>
    <xs:element name="startSession" type="tns:startSession"/>
    <xs:element name="startSessionLimited" type="tns:startSessionLimited"/>
    <xs:element name="startSessionLimitedResponse" type="tns:startSessionLimitedResponse"/>
    <xs:element name="startSessionResponse" type="tns:startSessionResponse"/>
    <xs:complexType name="startSession">
    <xs:sequence/>
    </xs:complexType>
    <xs:complexType name="startSessionResponse">
    <xs:sequence>
    <xs:element name="return" type="ns1:EndpointReferenceType" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>

    Thanks again

    Thursday, June 4, 2020 7:26 AM