4

I have a wsdl file, lot of xsd files, jxb binding file. I created a web service client using Apache CXF cxf-codegen-plugin. Java classes are created without any errors. But when I try to call any of the generated methods, I get an exception:

Exception in thread "main" javax.xml.ws.WebServiceException: class com.amadeus.xml.pnracc_11_1_1a.PNRReply do not have a property of the name {http://xml.amadeus.com/PNRACC_11_1_1A}PNR_Reply

I call the webservice method like this (don't worry about the nulls):

AmadeusWebServices aws = new AmadeusWebServices();
aws.getAmadeusWebServicesPort().fareMasterPricerCalendar(null, null);

Stack trace:

Exception in thread "main" javax.xml.ws.WebServiceException: class com.amadeus.xml.pnracc_11_1_1a.PNRReply do not have a property of the name {http://xml.amadeus.com/PNRACC_11_1_1A}PNR_Reply
at com.sun.xml.internal.ws.client.sei.ValueSetter$AsyncBeanValueSetter.<init>(ValueSetter.java:165)
at com.sun.xml.internal.ws.client.sei.ValueSetterFactory$AsyncBeanValueSetterFactory.get(ValueSetterFactory.java:67)
at com.sun.xml.internal.ws.client.sei.SEIMethodHandler.buildResponseBuilder(SEIMethodHandler.java:163)
at com.sun.xml.internal.ws.client.sei.AsyncMethodHandler.<init>(AsyncMethodHandler.java:121)
at com.sun.xml.internal.ws.client.sei.PollingMethodHandler.<init>(PollingMethodHandler.java:39)
at com.sun.xml.internal.ws.client.sei.SEIStub.initMethodHandlers(SEIStub.java:99)
at com.sun.xml.internal.ws.client.sei.SEIStub.<init>(SEIStub.java:73)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:590)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:312)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:294)
at javax.xml.ws.Service.getPort(Service.java:119)
at com.amadeus.xml.AmadeusWebServices.getAmadeusWebServicesPort(AmadeusWebServices.java:78)
at com.mycompany.test1.App.main(App.java:16)
Caused by: javax.xml.bind.JAXBException: {http://xml.amadeus.com/PNRACC_11_1_1A}PNR_Reply is not a valid property on class com.amadeus.xml.pnracc_11_1_1a.PNRReply
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:966)
at com.sun.xml.internal.ws.client.sei.ValueSetter$AsyncBeanValueSetter.<init>(ValueSetter.java:162)
... 13 more

My environment:

java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-5)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
NetBeans IDE 7.3.1

Am I missing something? I am jus trying to create very simple web service client. I've put sample project with all the wsdl and xsd files I'm using on GitHub

Thank you for any suggestions.

2 Answers 2

10

Looks like you hit a bug in Oracle's JAX-WS implementation. If you add:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
</dependency>

to the dependencies to use CXF's JAX-WS implementation, it seems to work OK. I also tried generating the code with the wsimport command and get the same error so the generated code seems OK.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you Daniel, after adding that dependency I can successfuly call the webservice methods. However another exceptions arised after trying to deploy simple JAXRS application to glassfish, I created new question, you can watch it here if you're interested stackoverflow.com/questions/19045664/…
@Daniel Kulp Does anyone know what exactly the bug is? and why hasn't it been fixed :(
For me it was the return type of a HashMap which was actually not supported by JBoss Wildfly. Adding this dependency solved the problem. Thanks!
1

I have faced this issue and find that it occurs because of encoding issues in generated java class, it is interesting that it throws same exception. Encoding Error Screenshot You can generate java class with wsimport -keep and check java classes for this issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.