First here is what I want to do:
I want to create a webservice that calls a java function void doSomething(ParamType value);
when it receives the SOAP message
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<paramType>
<elem>test</elem>
</paramType>
</soapenv:Body>
</soapenv:Envelope>
Note the missing namespace of paramType.
I created the following class to contain the doSomething function:
@WebService(name = "doSomethingPort", targetNamespace = "http://www.tim.org/nsClass/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public class DoSomethingImpl {
@WebMethod(action = "http://sap.com/xi/WebService/soap1.1")
@Oneway
public void doSomething(
@WebParam(name = "paramType", targetNamespace = "http://www.tim.org/nsParam/", partName = "value")
ParamType value)
{
System.out.println("Hallo Welt");
}
}
and the following class to hold the parameter:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", namespace="http://www.tim.org/nsXMLType/")
@XmlRootElement(name="paramType", namespace="http://www.tim.org/nsXMLRootElem/")
public class ParamType {
@XmlElement(required = true)
protected String elem;
public String getElem() {
return elem;
}
public void setElem(String value) {
this.elem = value;
}
}
The webservice is started with:
Endpoint.publish( "http://localhost:8090/services", new DoSomethingImpl());
The result after some testing is:
This webservice accepts messages in which the paramType has a namespace: <nsp:paramType xmlns:nsp="http://www.tim.org/nsParam/">
When I leave the targetNamepace declaration on the parameter he uses the targetNamespace on the DoSomethingImpl class (the http://www.tim.org/nsClass/
)
Removing the namespace there causes the webservice to create a namespace from his package name.
Does anybody has an Idea how I get a webservice accepting that message? I would prefer to repair/reconfigure my existing webservice, but I would accept other ways to accept the message and call the doSomething function.