我有一個相當令人沮喪的問題,試圖調用需要附件的網絡服務。呼叫帶附件的網絡服務
這是錯誤:
Unexpected Attachment type =class java.lang.Object
從這裏:
class="com.sun.xml.ws.client.sei.ResponseBuilder$AttachmentBuilder" file="ResponseBuilder.java" line="250" method="createAttachmentBuilder"
Web代理給我的方法是這樣的:
public Reply putDocument(
@WebParam(targetNamespace="uri:put.document", partName="request", name="request")
StoreType request,
@WebParam(targetNamespace="", partName="put", name="put")
Object put);
我想不通的是什麼傳入「put」,它只被定義爲一個Object。
我曾嘗試:
byte[]
String
DataHandler(ByteArrayDataSource)
uri.put_document.ObjectFactory.createPut(byte[])
AttachmentPart
我也試圖尋找的代碼,但還沒有運氣這麼遠。
編輯:WSDL如下。
<?xml version="1.0" encoding="UTF-8" ?>
<definitions targetNamespace="urn:fer"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:fer"
xmlns:get="uri:get.document"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
<types>
<xsd:schema>
<xsd:import namespace="uri:get.document"
schemaLocation="../xsd/getDocument.xsd"/>
</xsd:schema>
</types>
<message name="putDocument">
<part name="request" element="put:request"/>
<part name="put" element="put:put"/>
</message>
<message name="putDocumentReply">
<part name="reply" element="put:reply"/>
</message>
<portType name="FrontEndRepository">
<operation name="putDocument">
<input message="tns:putDocument"/>
<output message="tns:putDocumentReply"/>
</operation>
</portType>
<binding name="frontEndRepositoryPortSOAP11Binding"
type="tns:FrontEndRepository">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="putDocument">
<soap:operation style="document"
soapAction="putDocument"/>
<input>
<mime:multipartRelated>
<mime:part>
<soap:body use="literal" parts="request"/>
</mime:part>
<mime:part>
<mime:content part="put" type="binary"/>
</mime:part>
</mime:multipartRelated>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="FrontEndRepository">
<port name="FrontEndRepository"
binding="tns:frontEndRepositoryPortSOAP11Binding">
<soap:address location="http://localhost:7101/FER-FrontEndrepository-context-root/frontEndRepositoryPort"/>
</port>
</service>
</definitions>
我們需要你的WSDL。也看看這裏https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html – 2010-06-25 01:34:08
@Romain:添加了WSDL。謝謝! – 2010-06-25 03:09:18
你可以通過它null或虛擬字符串?任何可序列化的非對象實例似乎都可能成功。 – 2010-06-25 08:09:18