You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Carlos Garces <ca...@gmail.com> on 2012/06/14 14:02:28 UTC
Error using auto-generated client from wsdl2java
Hi!
I’m using apache-cxf-2.6.1 and JDK 1.6 and I have one error using the
Client web service autogenerated by apache cfx
I have generated the code with wsdl2java
C:\>.\apache-cxf-2.6.1\bin\wsdl2java.bat -wsdlLocation "" -frontend jaxws21
-client myservice.wsdl
Several files are created, also
myServiceSEI_myServicePort_Client with a main() method
Pasing the wsdl as parameter to the main method I obtain the following
stacktrace at this line.
javax.activation.DataHandler _getPDF__return = port.getPDF(_getPDF_docName);
Exception in thread "main"
com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML
tag. expected: {http://myservice/test}getPDFResponse but found: {
http://myservice/test}getPDF
at
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:201)
at
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:209)
at
com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.readResponse(ResponseBuilder.java:511)
at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:254)
at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:222)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:115)
at $Proxy32.getPDF(Unknown Source)
at
com.test.myServiceSEI_myServicePort_Client.main(myServiceSEI_myServicePort_Client.java:59)
The service code is...
@WebResult(name = "return", targetNamespace = "")
@Action(input = "http://myservice/myServiceSEI/getPDFRequest", output = "
http://myservice/myServiceSEI/getPDFResponse"})
@RequestWrapper(localName = "getPDF", targetNamespace = "
http://myservice/test", className = "com.test.GetPDF")
@WebMethod
@ResponseWrapper(localName = "getPDFResponse", targetNamespace = "{
http://myservice/test", className = "com.test.GetPDFResponse")
public javax.activation.DataHandler getPDF(
@WebParam(name = "docName", targetNamespace = "")
java.lang.String docName,
@WebParam(name = "docSequenceNumber", targetNamespace = "")
java.lang.String docSequenceNumber
);
It's just the auto-generated code, I'm not changing anything (not yet)
Any idea about the error?
Un saludo
Carlos Garcés
Re: Error using auto-generated client from wsdl2java
Posted by Daniel Kulp <dk...@apache.org>.
Well, for one, you aren't using CXF. This is using the JDK built in JAX-WS
implementation. Make sure you have the CXF jars on the classpath.
Second, it looks like the returned SOAP message from the service is wrong.
According to the wsdl/annotations, the child element in the soap:Body should
be {http://myservice/test}getPDFResponse. However, the value it's reading
off the wire is {http://myservice/test}getPDF. Definitely check the
service to make sure it's really matching the wsdl.
Dan
On Thursday, June 14, 2012 02:02:28 PM Carlos Garces wrote:
> Hi!
>
> I’m using apache-cxf-2.6.1 and JDK 1.6 and I have one error using the
> Client web service autogenerated by apache cfx
>
> I have generated the code with wsdl2java
> C:\>.\apache-cxf-2.6.1\bin\wsdl2java.bat -wsdlLocation "" -frontend
> jaxws21 -client myservice.wsdl
>
> Several files are created, also
>
> myServiceSEI_myServicePort_Client with a main() method
>
> Pasing the wsdl as parameter to the main method I obtain the following
> stacktrace at this line.
>
> javax.activation.DataHandler _getPDF__return =
> port.getPDF(_getPDF_docName);
>
> Exception in thread "main"
> com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML
> tag. expected: {http://myservice/test}getPDFResponse but found: {
> http://myservice/test}getPDF
> at
> com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamR
> eaderUtil.java:201) at
> com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamR
> eaderUtil.java:209) at
> com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.readResponse(Res
> ponseBuilder.java:511) at
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHand
> ler.java:254) at
> com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHand
> ler.java:222) at
> com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:115) at
> $Proxy32.getPDF(Unknown Source)
> at
> com.test.myServiceSEI_myServicePort_Client.main(myServiceSEI_myServicePort
> _Client.java:59)
>
> The service code is...
>
> @WebResult(name = "return", targetNamespace = "")
> @Action(input = "http://myservice/myServiceSEI/getPDFRequest", output =
> " http://myservice/myServiceSEI/getPDFResponse"})
> @RequestWrapper(localName = "getPDF", targetNamespace = "
> http://myservice/test", className = "com.test.GetPDF")
> @WebMethod
> @ResponseWrapper(localName = "getPDFResponse", targetNamespace = "{
> http://myservice/test", className = "com.test.GetPDFResponse")
> public javax.activation.DataHandler getPDF(
> @WebParam(name = "docName", targetNamespace = "")
> java.lang.String docName,
> @WebParam(name = "docSequenceNumber", targetNamespace = "")
> java.lang.String docSequenceNumber
> );
>
> It's just the auto-generated code, I'm not changing anything (not yet)
>
> Any idea about the error?
>
> Un saludo
> Carlos Garcés
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com