I built the wsdl-client-stub based on xmlbeans. Now I got stuck adding a custom header for authentification using xmlbeans since xmlbeans stubs are lacking the necessary Classes(?)
Actually, the header should look like:
<SOAP-ENV:Header>
<ns2:verifyingToken>
<UserID>9</UserID>
<Token>29438094lkjslfkjlsdkjf</Token>
</ns2:verifyingToken>
</SOAP-ENV:Header>
So I tried as fallback going in between stub and ServiceClient:
ServiceClient sc = stub._getServiceClient();
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement omElement = omFactory.createOMElement(new QName("SOAP-ENV", "Header", "ver"), null);
OMElement omElementVeri = omFactory.createOMElement(new QName("", "verifyingToken", ""), omElement);
OMElement omElementUser = omFactory.createOMElement(new QName("", "UserID", ""), omElementVeri);
omElementUser.setText(""+userid);
OMElement omElementPass = omFactory.createOMElement(new QName("", "Token", ""), omElementVeri);
omElementPass.setText(""+token);
sc.addHeader(omElement);
eclipse is raising errors saying: The method createOMElement(String, OMNamespace) in the type OMFactory is not applicable for the arguments (QName, null) - The constructor QName(String, String, String) is undefined
Does anyone has a hint, what I should fix, to get this to work. I really appreciate your help,
Alex