posted 11 years ago
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.