Search code examples
wsdljax-wsjax-rpc

Converting an old JAX RPC WSDL file to a JAX WS WSDL file


I was wondering if is there some way to convert an old RPC WSDL file to a JAX-WS WSDL file. Tried my best to make sure I did my homework but I'm kind of lost here.

From what I've read, I should remove all the 'encodingstyle' ocurrences and switch use="encoded" to use="literal". I can't run any tests by now since the service is currently unavailable. Does anyone know if that should be enough? Any insight will be extremely appreciated.

This is my WSDL file:

<?xml version="1.0" encoding="iso-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wsScrc.XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wsScrc.XML">
<types>
    <xsd:schema targetNamespace="urn:wsScrc.XML">
       <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
       <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
    </xsd:schema>
</types>

<message name="XMLRequest">
    <part name="parmA" type="xsd:string" />
    <part name="parmB" type="xsd:string" />
    <part name="parmC" type="xsd:string" />
    <part name="parmD" type="xsd:string" />
    <part name="parmE" type="xsd:string" />
    <part name="parmF" type="xsd:string" />
    <part name="parmG" type="xsd:string" />
</message>

<message name="XMLResponse">
    <part name="respA" type="xsd:string" />
    <part name="respB" type="xsd:string" />
    <part name="respC" type="xsd:string" />
    <part name="respD" type="xsd:string" />
    <part name="respE" type="xsd:string" />
</message>

<message name="monitorRequest"></message>

<message name="monitorResponse">
    <part name="ipServidor" type="xsd:string" />
</message>

<portType name="wsScrc.XMLPortType">
    <operation name="XML">
        <documentation>Retorna o xml</documentation>
        <input message="tns:XMLRequest"/>
        <output message="tns:XMLResponse"/>
    </operation>

    <operation name="monitor">
        <documentation>Retorna uma mensagem de ok</documentation>
        <input message="tns:monitorRequest"/>
        <output message="tns:monitorResponse"/>
    </operation>
</portType>

<binding name="wsScrc.XMLBinding" type="tns:wsScrc.XMLPortType">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="XML">
        <soap:operation soapAction="urn:wsScrc.XML#XML" style="rpc"/>
        <input>
            <soap:body use="encoded" namespace="urn:wsScrc.XML"              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>

        <output>
            <soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
    </operation>

    <operation name="monitor">
        <soap:operation soapAction="urn:wsScrc.monitor#monitor" style="rpc"/>
        <input>
            <soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>

        <output>
            <soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
    </operation>
</binding>

<service name="wsScrc.XML">
    <port name="wsScrc.XMLPort" binding="tns:wsScrc.XMLBinding">
        <soap:address location="http://thisismyaddress/webservicePHP/ws.php"/>
    </port>
</service>
</definitions>

Thanks in advance.


Solution

  • We were able to do the same by altering the WSDL in that way.

    The only issue is that we had to use SAAJ in order to generate the right request and to process the response.

    In another WS we used it was just not possible because the XML in the body is generated by Castor. Finally we did not succeed as we did not know what the server expect.

    In conclusion I would say: it depends how the server was implemented.