生成wsdl的时候 出现xs:anyType

本文介绍了一位开发者在使用Axis2部署服务时遇到的WSDL生成问题。具体表现为函数参数类型及返回值类型被错误地标识为anyType。通过调整services.xml文件中messageReceiver配置,从RawXMLINOutMessageReceiver改为RPCMessageReceiver,成功解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在进行axis2开发的时候,一开始遇到很莫名其妙的问题,部署aar之后,发现生成的wsdl对于函数的参数值类型和返回值类型 全部都是anyType,一开始以为是由于axis2不支持这些类型,不过后来突然发现原因可能是在于services.xml的错误。

例如:

<service name="IntegrationLayer" provider="java:RPC">
    <description> provides services</description>
    <parameter name="ServiceClass" locked="false">Test</parameter>
    <operation name="test">
                <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </operation>
</service>
上面的provider 属性指明了使用RPC,则下面的messageReceiver 也是对应的RPCMessageReceiver。

之前我写成了<messageReceiver              class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />

从而导致wsdl生成有错误。希望能提供给大家一点启示。


String localPart参数指的是一下wdsl文件的那个参数;<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.mes.service.basic.example.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="MesWebServiceImplService" targetNamespace="http://webservice.mes.service.basic.example.com"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.mes.service.basic.example.com" elementFormDefault="unqualified" targetNamespace="http://webservice.mes.service.basic.example.com" version="1.0"> <xs:element name="getAllTechByProCode" type="tns:getAllTechByProCode"/> <xs:element name="getAllTechByProCodeResponse" type="tns:getAllTechByProCodeResponse"/> <xs:complexType name="getAllTechByProCode"> <xs:sequence> <xs:element minOccurs="0" name="productCode" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="getAllTechByProCodeResponse"> <xs:sequence> <xs:element minOccurs="0" name="return" type="tns:result"/> </xs:sequence> </xs:complexType> <xs:complexType name="result"> <xs:sequence> <xs:element minOccurs="0" name="code" type="xs:int"/> <xs:element minOccurs="0" name="data" type="xs:anyType"/> <xs:element minOccurs="0" name="msg" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="getAllTechByProCodeResponse"> <wsdl:part element="tns:getAllTechByProCodeResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="getAllTechByProCode"> <wsdl:part element="tns:getAllTechByProCode" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="IMesWebService"> <wsdl:operation name="getAllTechByProCode"> <wsdl:input message="tns:getAllTechByProCode" name="getAllTechByProCode"> </wsdl:input> <wsdl:output message="tns:getAllTechByProCodeResponse" name="getAllTechByProCodeResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:bindi
03-13
This XML file does not appear to have any style information associated with it. The document tree is shown below. <!-- Schema defined in the SOAP Version 1.2 Part 1 specification Recommendation: http://www.w3.org/TR/2003/REC-soap12-part1-20030624/ $Id: soap-envelope.xsd,v 1.2 2006/12/20 20:43:36 ylafon Exp $ Copyright (C)2003 W3C(R) (MIT, ERCIM, Keio), All Rights Reserved. W3C viability, trademark, document use and software licensing rules apply. http://www.w3.org/Consortium/Legal/ This document is governed by the W3C Software License [1] as described in the FAQ [2]. [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720 [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2003/05/soap-envelope" targetNamespace="http://www.w3.org/2003/05/soap-envelope" elementFormDefault="qualified"> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> <!-- Envelope, header and body --> <xs:element name="Envelope" type="tns:Envelope"/> <xs:complexType name="Envelope"> <xs:sequence> <xs:element ref="tns:Header" minOccurs="0"/> <xs:element ref="tns:Body" minOccurs="1"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> <xs:element name="Header" type="tns:Header"/> <xs:complexType name="Header"> <xs:annotation> <xs:documentation> Elements replacing the wildcard MUST be namespace qualified, but can be in the targetNamespace </xs:documentation> </xs:annotation> <xs:sequence> <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> <xs:element name="Body" type="tns:Body"/> <xs:complexType name="Body"> <xs:sequence> <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> <!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. --> <xs:attribute name="mustUnderstand" type="xs:boolean" default="0"/> <xs:attribute name="relay" type="xs:boolean" default="0"/> <xs:attribute name="role" type="xs:anyURI"/> <!-- 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://www.w3.org/2003/05/soap-encoding' indicates the pattern described in the SOAP Version 1.2 Part 2: Adjuncts Recommendation --> <xs:attribute name="encodingStyle" type="xs:anyURI"/> <xs:element name="Fault" type="tns:Fault"/> <xs:complexType name="Fault" final="extension"> <xs:annotation> <xs:documentation> Fault reporting structure </xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="Code" type="tns:faultcode"/> <xs:element name="Reason" type="tns:faultreason"/> <xs:element name="Node" type="xs:anyURI" minOccurs="0"/> <xs:element name="Role" type="xs:anyURI" minOccurs="0"/> <xs:element name="Detail" type="tns:detail" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="faultreason"> <xs:sequence> <xs:element name="Text" type="tns:reasontext" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="reasontext"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="xml:lang" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="faultcode"> <xs:sequence> <xs:element name="Value" type="tns:faultcodeEnum"/> <xs:element name="Subcode" type="tns:subcode" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:simpleType name="faultcodeEnum"> <xs:restriction base="xs:QName"> <xs:enumeration value="tns:DataEncodingUnknown"/> <xs:enumeration value="tns:MustUnderstand"/> <xs:enumeration value="tns:Receiver"/> <xs:enumeration value="tns:Sender"/> <xs:enumeration value="tns:VersionMismatch"/> </xs:restriction> </xs:simpleType> <xs:complexType name="subcode"> <xs:sequence> <xs:element name="Value" type="xs:QName"/> <xs:element name="Subcode" type="tns:subcode" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="detail"> <xs:sequence> <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> <!-- Global element declaration and complex type definition for header entry returned due to a mustUnderstand fault --> <xs:element name="NotUnderstood" type="tns:NotUnderstoodType"/> <xs:complexType name="NotUnderstoodType"> <xs:attribute name="qname" type="xs:QName" use="required"/> </xs:complexType> <!-- Global element and associated types for managing version transition as described in Appendix A of the SOAP Version 1.2 Part 1 Recommendation --> <xs:complexType name="SupportedEnvType"> <xs:attribute name="qname" type="xs:QName" use="required"/> </xs:complexType> <xs:element name="Upgrade" type="tns:UpgradeType"/> <xs:complexType name="UpgradeType"> <xs:sequence> <xs:element name="SupportedEnvelope" type="tns:SupportedEnvType" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:schema>
最新发布
08-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值