问题描述
有个webservice付款接口,其中付款金额amount加密后为byte[],但是用wsdl2java根据wsdl文件生成java代码中,金额为datahandler,该如何解决?wsdl文件如下:<?xmlversion="1.0"encoding="UTF-8"?><wsdl:definitionstargetNamespace="http://service.hundsun.com"xmlns:ns1="http://dto.hundsun.com"xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"xmlns:tns="http://service.hundsun.com"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><wsdl:types><xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"attributeFormDefault="qualified"elementFormDefault="qualified"targetNamespace="http://dto.hundsun.com"><xsd:complexTypename="PayRequest"><xsd:sequence><xsd:elementminOccurs="0"name="batchSeqID"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="pd"nillable="true"type="ns1:ArrayOfPayRequestDetail"/><xsd:elementminOccurs="0"name="requestTime"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="source"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="totalAmount"type="xsd:double"/><xsd:elementminOccurs="0"name="totalCount"type="xsd:int"/><xsd:elementminOccurs="0"name="verifyField"nillable="true"type="xsd:string"/></xsd:sequence></xsd:complexType><xsd:complexTypename="ArrayOfPayRequestDetail"><xsd:sequence><xsd:elementmaxOccurs="unbounded"minOccurs="0"name="PayRequestDetail"nillable="true"type="ns1:PayRequestDetail"/></xsd:sequence></xsd:complexType><xsd:complexTypename="PayRequestDetail"><xsd:sequence><xsd:elementminOccurs="0"name="accOrg"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="amount"nillable="true"type="xsd:base64Binary"/><xsd:elementminOccurs="0"name="applyDeptCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute1"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute2"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute3"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute4"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute5"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute6"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute7"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="attribute8"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="bizRefCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="budgetItemCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="bzType"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="cardFlag"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="categoryCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="credentials"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="currency"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="cvvCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="dealType"type="xsd:int"/><xsd:elementminOccurs="0"name="des"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="detailSeqID"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="dsCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="email"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="idCard"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="insCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="memo"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="moneyWay"type="xsd:int"/><xsd:elementminOccurs="0"name="noteMoney"type="xsd:float"/><xsd:elementminOccurs="0"name="payAccount"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payAccountName"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payBank"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payBankArea"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payBankLocation"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payCurrency"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payDate"type="xsd:dateTime"/><xsd:elementminOccurs="0"name="payEntityCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payName"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="payObjectType"type="xsd:int"/><xsd:elementminOccurs="0"name="phoneNum"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recAccount"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recAccountName"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recBank"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recBankArea"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recBankLocation"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recName"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="recObjectType"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="subCategoryCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="urgent"type="xsd:int"/><xsd:elementminOccurs="0"name="useDes"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="validDate"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="vendorCode"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="verifyField"nillable="true"type="xsd:string"/></xsd:sequence></xsd:complexType><xsd:complexTypename="PayResponse"><xsd:sequence><xsd:elementminOccurs="0"name="errorMsg"nillable="true"type="xsd:string"/><xsd:elementminOccurs="0"name="responseCode"type="xsd:int"/></xsd:sequence></xsd:complexType></xsd:schema><xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"attributeFormDefault="qualified"elementFormDefault="qualified"targetNamespace="http://service.hundsun.com"><xsd:elementname="Pay"><xsd:complexType><xsd:sequence><xsd:elementmaxOccurs="1"minOccurs="1"name="in0"nillable="true"type="ns1:PayRequest"/></xsd:sequence></xsd:complexType></xsd:element><xsd:elementname="PayResponse"><xsd:complexType><xsd:sequence><xsd:elementmaxOccurs="1"minOccurs="1"name="out"nillable="true"type="ns1:PayResponse"/></xsd:sequence></xsd:complexType></xsd:element></xsd:schema></wsdl:types><wsdl:messagename="PayRequest"><wsdl:partname="parameters"element="tns:Pay"/></wsdl:message><wsdl:messagename="PayResponse"><wsdl:partname="parameters"element="tns:PayResponse"/></wsdl:message><wsdl:portTypename="FundPayServicePortType"><wsdl:operationname="Pay"><wsdl:inputname="PayRequest"message="tns:PayRequest"/><wsdl:outputname="PayResponse"message="tns:PayResponse"/></wsdl:operation></wsdl:portType><wsdl:bindingname="FundPayServiceHttpBinding"type="tns:FundPayServicePortType"><wsdlsoap:bindingstyle="document"transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operationname="Pay"><wsdlsoap:operationsoapAction=""/><wsdl:inputname="PayRequest"><wsdlsoap:bodyuse="literal"/></wsdl:input><wsdl:outputname="PayResponse"><wsdlsoap:bodyuse="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:servicename="FundPayService"><wsdl:portname="FundPayServiceHttpPort"binding="tns:FundPayServiceHttpBinding"><wsdlsoap:addresslocation="http://10.1.17.123:8001/service/fundpay.ws"/></wsdl:port></wsdl:service></wsdl:definitions>
解决方案
解决方案二:
来人指点下
解决方案三:
貌似没人解惑,结贴算了
解决方案四:
构造这样一个对象,提供的应该有set方法吧。
解决方案五:
DataSourcesource=newByteDataSource(bytes);newDataHandler(source)
解决方案六:
DataSourcesource=newByteDataSource(bytess);newDataHandler(source)
解决方案七:
这是我在项目中使用的方法DataHandlerhandler=stub.queryService().get_return();byte[]buffer=newbyte[handler.getInputStream().available()];handler.getInputStream().read(buffer);Map<String,String>services=(Map<String,String>)Util.byte2Object(buffer);
publicstaticObjectbyte2Object(byte[]buffer)throwsException{ObjectInputStreamois=null;Objectobj=null;try{ByteArrayInputStreambis=newByteArrayInputStream(buffer);ois=newObjectInputStream(bis);obj=ois.readObject();}finally{IOUtils.closeQuietly(ois);}returnobj;}