Skip to main content

JAXWS/JAXB namespace issue with Axis server

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-07-21


I'm using JaxWS 2.2.3 to connect to Axis Web Services.

Attached you can find the WSDL.

After generating the stub with wsimport ( -Xendorsed -s src/ testws.wsdl), I tried to consume Handshake service method but I cannot get all response values.

This is the snippet of the main code:

TestWS_Service service = new TestWS_Service();
TestWS port = service.getTest();
BindingProvider bp = (BindingProvider) port;
Map<String, Object> context = bp.getRequestContext();
context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL);
ProtoHandshakeResult hsr = port.handshakeReq();
System.out.println("#### Server date: " + hsr.getServerDateString());
System.out.println("#### Load       : " + hsr.getLoad());

The response is:

HTTP/1.1 200 OK
Date: Thu, 21 Jul 2011 15:13:30 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 PHP/5.2.4
Content-Length: 442
Connection: close
Content-Type: text/xml
&lt;?xml version='1.0' encoding='utf-8' ?&gt;<br />&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;; xmlns:xsd=&quot;; xmlns:xsi=&quot;;&gt;<br />&lt;SOAP-ENV:Body&gt;<br />&lt;ns1:handshakeResponse xmlns:ns1=&quot;;&gt;<br />&lt;result serverDate_string=&quot;2011-07-21 17:13:30&quot;&gt;&lt;ns1:load&gt;2&lt;/ns1:load&gt;<br />&lt;/result&gt;<br />&lt;/ns1:handshakeResponse&gt;<br />&lt;/SOAP-ENV:Body&gt;

I'm able to get serverDate_string value but I get a null value for load.
The issue seems related to the namespace prefix ns1: if I force namespace on the JAXB generated element (see line in bold below), all works fine.

@XmlType(name = &quot;ProtoHandshakeResult&quot;, propOrder = {&quot;load&quot;})

public class ProtoHandshakeResult {

    protected Integer load;
    @XmlAttribute(name = &quot;serverDate_string&quot;)
    protected String serverDateString;

What's wrong in my implementation? I would avoid to modify generated code each time WSDL is modified!

Thanks for any info.

testws_wsdl.txt2.62 KB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-07-21

Any idea about that issue?

Thank you.