论坛首页 Java版 SOA

WSDL复杂自定义数据类型解析

浏览 1688 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
时间:2007-07-17
请问对WSDL的解析用哪个包最好?我用的是wsdl4j,但是不知道如何解析<complexType>,即那些自定义的复杂数据类型.

比如下面这个wsdl文件
我想把Point类型解析出来,从而知道它是由x:double和y:double组成的.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/services/MyMath" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/MyMath" xmlns:intf="http://localhost:8080/axis/services/MyMath" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:BeanService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="urn:BeanService"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Vector">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>

</sequence>
</complexType>
</schema>
<schema targetNamespace="urn:BeanService" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xml.apache.org/xml-soap"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Point">
<sequence>
<element name="x" type="xsd:double"/>

<element name="y" type="xsd:double"/>
</sequence>
</complexType>

</schema>
</wsdl:types>

<wsdl:message name="squaredResponse">

<wsdl:part name="squaredReturn" type="apachesoap:Vector"/>

</wsdl:message>

<wsdl:message name="squaredRequest">

<wsdl:part name="in0" type="xsd:int"/>

</wsdl:message>

<wsdl:message name="distanceResponse">

<wsdl:part name="distanceReturn" type="xsd:double"/>

</wsdl:message>

<wsdl:message name="distanceRequest">

<wsdl:part name="in0" type="tns1:Point"/>

<wsdl:part name="in1" type="tns1:Point"/>

</wsdl:message>

<wsdl:portType name="MyMath">

<wsdl:operation name="squared" parameterOrder="in0">

<wsdl:input message="impl:squaredRequest" name="squaredRequest"/>

<wsdl:output message="impl:squaredResponse" name="squaredResponse"/>

</wsdl:operation>

<wsdl:operation name="distance" parameterOrder="in0 in1">

<wsdl:input message="impl:distanceRequest" name="distanceRequest"/>

<wsdl:output message="impl:distanceResponse" name="distanceResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="MyMathSoapBinding" type="impl:MyMath">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="squared">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="squaredRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input>

<wsdl:output name="squaredResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/MyMath" use="encoded"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="distance">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="distanceRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input>

<wsdl:output name="distanceResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/MyMath" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="MyMathService">

<wsdl:port binding="impl:MyMathSoapBinding" name="MyMath">

<wsdlsoap:address location="http://localhost:8080/axis/services/MyMath"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

PS:我用eclipse的wtp插件的时候,觉得它对wsdl的解析非常漂亮,但是不知道如何去调用wtp对应的jar包。

有做过这方面工作的大侠能帮 帮我吗?
   
时间:2007-07-17
apache woden?
   
0 请登录后投票
时间:2007-07-19
谢谢comain :-)
我试一下。
   
0 请登录后投票
论坛首页 Java版 SOA

跳转论坛:
JavaEye推荐