Two Laptop Bag*
The moose likes Web Services and the fly likes JAXWS client generated with clientgen - Soap Message with attachment: response ok, attachment null. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXWS client generated with clientgen - Soap Message with attachment: response ok, attachment null." Watch "JAXWS client generated with clientgen - Soap Message with attachment: response ok, attachment null." New topic
Author

JAXWS client generated with clientgen - Soap Message with attachment: response ok, attachment null.

Glittery Lally
Greenhorn

Joined: Apr 08, 2010
Posts: 6
Hi everybody
I hope you can help me this is a little complicated...
I have a webservice sending a soap message with a pdf as attachment.
The webservice works (tested with soap ui, attachment are received i can open them)
My application is a webservice client, JAX-WS stubs have been generated with clientgen (runs on weblogic 10.3)

But when I run my code, I obtain a null attachment.

documentPort.documentRequest(request, responseHolder, documentBytesHolder);

responseHolder gets correctly filled (that means, endpoint works, etc)
It has a "value" with a response inside containing exactly the same stuff I obtain doing this request with SOAP UI.

The problem is, the documentBytesHolder object should contain the attachment (PDF byte array) but it is null.

I checked the server log (I have a soap handler printing outbound and inbound message) and the attachment gets correctly delivered.

So it must be a problem of my stubs

Also a note: with WSIMPORT I can't generate the stubs. Which is weird, because clientgen actually uses wsimport internally, and it generates the stubs without problems....

Here are my ant scripts

<clientgen
wsdl="${wsdl.dir}/${wsdl.file}"
destdir="${codegen.dir}"
autoDetectWrapped="false"
generateAsyncMethods="false"
type="JAXWS"
generateruntimecatalog="false"
verbose="true"
encoding="UTF-8"
wsdllocation="${wsdl.file}">
</clientgen>

<target name="create.stub" >
<wsimport
sourcedestdir="${codegen.dir}"
destdir="${codegen.dir}"
debug="true"
verbose="true"
extension="true"
wsdl="${wsdl.dir}/${wsdl.file}"
wsdllocation="${wsdl.file}"
>
</wsimport>
</target>

The error I obtain during the wsimport I can't understand, here it is:

[wsimport] [ERROR] Failed to generate Java signature: duplicate parameter names parameters. Use JAXWS binding customization to rename the wsdl:part "parameters"
[wsimport] line 31 of file:/C:/cvswork/edec_document_gui/lib-gen/edecDocumentServiceClient/src/main/resources/ch/e_dec/services/edecdocumentservice/v1/EdecDocumentService_v_0_1.wsdl
[wsimport] [ERROR] Failed to generate Java signature: duplicate parameter names parameters. Use JAXWS binding customization to rename the wsdl:part "parameters"
[wsimport] line 26 of file:/C:/cvswork/edec_document_gui/lib-gen/edecDocumentServiceClient/src/main/resources/ch/e_dec/services/edecdocumentservice/v1/EdecDocumentService_v_0_1.wsdl
[wsimport] Failed to parse the WSDL.


The thing is, I don't have duplicate parameter names in my wsdl :-S
Here are the wsdl lined it's referring to:

<message name="documentRequestRequest">
<documentation>Contains the parameters for a document request.</documentation>
<part name="parameters" element="documentRequest:documentRequest"/>
</message>

<message name="documentRequestResponse">
<documentation>Contains a concrete document. The PDF document will be added to the response as a base64-encoded part.</documentation>
<part name="parameters" element="documentResponse:documentRequestResponse"/>
<part name="e-dec_PDF_Document" type="xsd:base64Binary"/>
</message>

<message name="documentRequestFault">
<documentation>Contains the reason why the request failed.</documentation>
<part name="parameters" element="documentResponse:documentRequestResponse"/>
</message>

Thanks in advance for any help!!!


Laura



"Fatti non foste a viver come bruti, ma a seguir virtute e conoscenza"
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi. Did you find a solution? Please see if this helps: http://developer.amazonwebservices.com/connect/message.jspa?messageID=105277
Glittery Lally
Greenhorn

Joined: Apr 08, 2010
Posts: 6
Ok there were 2 different problems.
The stubs couldn't be generated with wsimport because I was using 2.1.1 jaxws (jaxws-tools and jaxws-rt) version.
There was a bug producing this error in the stubs generation.
I updated my classpath and used jaxws 2.1.3 and stubs could be correctly generated with WSIMPORT.
But there was the same error as in the stubs produced with clientge, which means,
documentBytesHolder still has no value ---> the attachment is NULL

Or better checked the server log, I DO receive the attachment, simply the stubs don't get filled....
any ideas???
Glittery Lally
Greenhorn

Joined: Apr 08, 2010
Posts: 6
we solved it, it didn't have to do with the stubs generation.
the webservice was delivering with the wrong content id so the stubs didn't find the byte array of the attachment

On soap UI I saw the response looked like that:

Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Description: e-dec_Export_tc302-1272678058753_10CHEE000001750661_1_
Content-ID: <e-dec_evv_Import=-6b69df18:1288c79b609:-70ec_1@edec.ezv.admin.ch>

this content id must be the same as defined in the wsdl

<message name="documentRequestResponse">
<documentation>Contains a concrete document. The PDF document will be added to the response as a base64-encoded part.</documentation>
<part name="parameters" element="documentResponse:documentRequestResponse"/>
<part name="e-dec_PDF_Document" type="xsd:base64Binary"/>
</message>

On soap ui it works because it delivers all the attachments

The stubs look for an attachment with the name " e-dec_evv_Import" and couldn't find it

So on the webservice they changed the code so that the content if is called e-dec_PDF_Document and now I receive my byteHolder filled :-D

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAXWS client generated with clientgen - Soap Message with attachment: response ok, attachment null.