In a Java project I created a webservice client using jax-ws and a wsdl. The request is valid xml but missing a prefix which is needed in this specific soap call. Currently I solve this by manually adding xmlns={@javax.xml.bind.annotation.XmlNs(prefix="gen", namespaceURI="http://schemas...")}) to the package-info.java class but feel this is not the best solution because the package-info is automatically created and my solution will be overwritten if for any reason the sources are generated again.
I suspect there is something missing in my wsdl.
Here's the wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="http://xmlns.example.com/1308658932768" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns0="http://schemas.triennium.com/Servicepunt/gen" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="Untitled" targetNamespace="http://xmlns.example.com/1308658932768">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.triennium.com/Servicepunt/gen"
targetNamespace="http://schemas.triennium.com/Servicepunt/gen"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="CallInfo">
<xs:complexType>
...
</xs:complexType>
</xs:element>
<xs:element name="ResponseStatus">
<xs:complexType>
...
</xs:complexType>
</xs:element>
<xs:element name="Credentials">
<xs:complexType>
...
</xs:complexType>
</xs:element>
<xs:element name="AuthenticateAannemerRequest">
<xs:complexType>
...
</xs:complexType>
</xs:element>
<xs:element name="AuthenticateAannemerResponse">
<xs:complexType>
...
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:service name="WSDL_Generator.2.0.2">
<wsdl:port name="AuthenticateAannemer.2.0.2" binding="tns:AuthenticateAannemer.2.0.2Binding">
<soap:address location="http://10.11.2.12:2592"/>
</wsdl:port>
</wsdl:service>
<wsdl:portType name="AuthenticateAannemer">
<wsdl:operation name="AuthenticateAannemer">
<wsdl:input message="tns:AuthenticateAannemerRequest"/>
<wsdl:output message="tns:AuthenticateAannemerResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AuthenticateAannemer.2.0.2Binding" type="tns:AuthenticateAannemer">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="AuthenticateAannemer">
<soap:operation style="document" soapAction="/AuthenticateAannemer.2.0.2/AuthenticateAannemer"/>
<wsdl:input>
<soap:body use="literal" parts="input"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" parts="output"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:message name="AuthenticateAannemerRequest">
<wsdl:part name="input" element="ns0:AuthenticateAannemerRequest"/>
</wsdl:message>
<wsdl:message name="AuthenticateAannemerResponse">
<wsdl:part name="output" element="ns0:AuthenticateAannemerResponse"/>
</wsdl:message>
</wsdl:definitions>
Here's the request without the prefix:
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<AuthenticateAannemerRequest xmlns="http://schemas.triennium.com/Servicepunt/gen">
<CallInfo>
<Customer>...</Customer>
<Module>...</Module>
<Version>...</Version>
</CallInfo>
<Credentials>
<Username>...</Username>
<Password>...</Password>
</Credentials>
</AuthenticateAannemerRequest>
</S:Body>
</S:Envelope>
Here's the request as I want it to be:
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<gen:AuthenticateAannemerRequest xmlns:gen="http://schemas.triennium.com/Servicepunt/gen">
<gen:CallInfo>
<gen:Customer>...</Customer>
<gen:Module>...</Module>
<gen:Version>...</Version>
</gen:CallInfo>
<gen:Credentials>
<gen:Username>...</Username>
<gen:Password>...</Password>
</gen:Credentials>
</gen:AuthenticateAannemerRequest>
</S:Body>
</S:Envelope>
edit: added prefix to namespacedeclaration in the second example, Which was there to start with, but was lost somehow while c/p the code.