File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Service removing soapenv:actor attribute from header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service removing soapenv:actor attribute from header" Watch "Web Service removing soapenv:actor attribute from header" New topic
Author

Web Service removing soapenv:actor attribute from header

Ashish Kirpan
Greenhorn

Joined: Jan 24, 2011
Posts: 22

Hi,

I created the webservice client and setting some header value in it, below is sample

<RequestorCredentials xmlns="https://paysecure/merchant.soap.header/" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<Token soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">9EB53237-1BF4-4E35-B70B-C703D41EA74F</Token>
<Version soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">1.0.0.0</Version>
<CallerID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">720261</CallerID>
<UserCredentials soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<UserID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">UBITEST</UserID>
<Password soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">ubitest@123</Password>
</UserCredentials>
</RequestorCredentials>

but when I form the header request, it contains some extra attributes are appended by default

soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"

I want to remove this attributes as web service rejecting my request due to these extra parameters.

Here is sample code which i used to form the header request

---------------------------------------
SOAPHeaderElement requestorCredentials = new SOAPHeaderElement(new QName("RequestorCredentials"));
requestorCredentials.setAttribute("xmlns", "https://paysecure/merchant.soap.header/");

SOAPHeaderElement eleToken = new SOAPHeaderElement(new QName("Token"));
eleToken.setValue(this.token);

SOAPHeaderElement eleVersion = new SOAPHeaderElement(new QName("Version"));
eleVersion.setValue(this.version);

SOAPHeaderElement eleCallerID = new SOAPHeaderElement(new QName("CallerID"));
eleCallerID.setValue(this.callerId);

requestorCredentials.addChild(eleToken);
requestorCredentials.addChild(eleVersion);
requestorCredentials.addChild(eleCallerID);

SOAPHeaderElement eleUserCred = new SOAPHeaderElement(new QName("UserCredentials"));

SOAPHeaderElement eleUserID = new SOAPHeaderElement(new QName("UserID"));
eleUserID.setValue(this.userId);

SOAPHeaderElement elePassword = new SOAPHeaderElement(new QName("Password"));
elePassword.setValue(this.password);

eleUserCred.addChild(eleUserID);
eleUserCred.addChild(elePassword);
requestorCredentials.addChild(eleUserCred);

System.out.println("XML : "+requestorCredentials.getAsString());

((org.apache.axis.client.Stub)portType).setHeader(requestorCredentials);
---------------------------------------
If anybody has idea of such kind of situation,please help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Service removing soapenv:actor attribute from header