【问题标题】:Converting an old JAX RPC WSDL file to a JAX WS WSDL file将旧的 JAX RPC WSDL 文件转换为 JAX WS WSDL 文件
【发布时间】:2011-10-05 17:24:28
【问题描述】:

我想知道是否有某种方法可以将旧的 RPC WSDL 文件转换为 JAX-WS WSDL 文件。尽我所能确保我完成了我的作业,但我有点迷失在这里。

根据我的阅读,我应该删除所有“编码风格”的出现并将use="encoded" 切换为use="literal"。由于该服务当前不可用,我现在无法运行任何测试。有谁知道这是否足够?任何见解都将不胜感激。

这是我的 WSDL 文件:

<?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>

提前致谢。

【问题讨论】:

    标签: wsdl jax-ws jax-rpc


    【解决方案1】:

    我们可以通过以这种方式更改 WSDL 来做同样的事情。

    唯一的问题是我们必须使用SAAJ 来生成正确的请求并处理响应。

    在我们使用的另一个 WS 中,这是不可能的,因为正文中的 XML 是由 Castor 生成的。最后我们没有成功,因为我们不知道服务器期望什么。

    最后我想说:这取决于服务器是如何实现的。

    【讨论】:

    • 谢谢!我很欣赏你的话。
    • @ruffp 为什么 Castor 的东西使得编码到文字的转换更难?
    猜你喜欢
    • 2021-10-10
    • 2012-06-06
    • 2013-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多