所以我使用eclipse实现了一个非常简单的web服务,并使用CXF生成了它的WSDL,这也是Mule中使用的框架。但是,当我尝试使用先前生成的WSDL在Mule中发布相同的服务时,它会因为来自CXF的“BadUsageException:-p invalid character”而停止。我使用Axis生成的WSDL尝试使用mule的java类,但是生成的CXF没有运气。
这是我的wsdl:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://snippet/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SnippetService" targetNamespace="http://snippet/">
<wsdl:types>
<xs:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://snippet/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" elementFormDefault="unqualified" targetNamespace="http://snippet/" version="1.0">
<xs:element name="multiply" type="tns:multiply"/>
<xs:element name="multiplyResponse" type="tns:multiplyResponse"/>
<xs:element name="sum" type="tns:sum"/>
<xs:element name="sumResponse" type="tns:sumResponse"/>
<xs:complexType name="sum">
<xs:sequence>
<xs:element name="arg0" type="xs:int"/>
<xs:element name="arg1" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sumResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="multiply">
<xs:sequence>
<xs:element name="arg0" type="xs:int"/>
<xs:element name="arg1" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="multiplyResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="multiplyResponse">
<wsdl:part element="tns:multiplyResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sumResponse">
<wsdl:part element="tns:sumResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sum">
<wsdl:part element="tns:sum" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="multiply">
<wsdl:part element="tns:multiply" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="InterNya">
<wsdl:operation name="sum">
<wsdl:input message="tns:sum" name="sum"></wsdl:input>
<wsdl:output message="tns:sumResponse" name="sumResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="multiply">
<wsdl:input message="tns:multiply" name="multiply"></wsdl:input>
<wsdl:output message="tns:multiplyResponse" name="multiplyResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SnippetServiceSoapBinding" type="tns:InterNya">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sum">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sum">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sumResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="multiply">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="multiply">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multiplyResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SnippetService">
<wsdl:port binding="tns:SnippetServiceSoapBinding" name="SnippetPort">
<soap:address location="http://localhost:8080/hassib/services/SnippetPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
任何帮助将不胜感激。感谢。
答案 0 :(得分:2)
使用Anypoint Studio 2014年7月版测试您的WSDL。 它正确地创建了您期望的Web服务类。 我使用了JavaSE-1.7和3.5.1 Mule引擎。
我是怎么做到的: 1.将HTTP端点拖到新流中 2.拖动CXF端点 3.打开CXF属性,并使用Service class属性
中的“Generate from WSDL”创建java类干杯, 帕特里克