I am facing one weird issue in web services. Functionality is working fine,but the response have some unneccessary namespace to the response element, That prefix is not at all defined in the wsdl or stubs. How to remove the unneccessary prefixes in the response element, that namespace is not at all defined in the WSDL. Please help me out to resolve.
Output:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<p30:realTimeWSProviderResponse xmlns:p30="http://eh.actimize.com">
<requestId/>
<searchDefinitionId/>
<generateAlert/>
Expected Output:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<RealTimeWSProviderResponse xmlns="http://eh.actimize.com">
<requestId xmlns=""/>
<searchDefinitionId xmlns=""/>
<generateAlert xmlns=""/>
<enableSuppression xmlns=""/>
<partyType xmlns=""/>
<partyKey xmlns=""/>
<names xmlns="">
I'm working on a web service project, where I need to alter the default namespace of a soap envelope. I am using axis-1.4. The following is the generated SOAP envelope.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<v1:addClaimRequest xmlns="">
<v1:ClaimsAddRq xsi:type="xsd:string"><ifx:RqUID>004030000075</ifx:RqUID>
</v1:ClaimsAddRq>
</v1:addClaimRequest>
</soapenv:Body>
</soapenv:Envelope>
Following is my Java code:
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("v1");
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new QName("xmlns:v1=urn://shivamath.com/prodschnsmngt/v1/","v1:addClaimRequest"));
_call.addParameter("v1:ClaimsAddRq",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
_call.setTargetEndpointAddress(locator);
_call.setEncodingStyle("");
setRequestHeaders(_call);
setAttachments(_call);
Following is the expected namespace to generate:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v1="urn://grupoaval.com/prodschnsmngt/v1/"
xmlns:ifx="urn://grupoaval.com/xsd/ifx/">
<soapenv:Body>
<v1:addClaimRequest xmlns="">
<v1:ClaimsAddRq xsi:type="xsd:string"><ifx:RqUID>004030000075</ifx:RqUID>
</v1:ClaimsAddRq>
</v1:addClaimRequest>
</soapenv:Body>
Please guide me out of this problem.
I'm using a endpoint SOAP created On Spring Framework using JAXB, but I want that my anwers(Expected Response) return without prefix when I Send Request One, but this is returned like is showed on Current Response:.
How can I do to return a message SOAP without namespaces?
Request One
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<soapenv:Header/>
<soapenv:Body>
<urn:ZProveerDatosPagoProveed2>
<Bukrs>RG10</Bukrs>
<Langu>S</Langu>
<Lifnr>00000000</Lifnr>
</urn:ZProveerDatosPagoProveed2>
</soapenv:Body>
</soapenv:Envelope>
Current Response:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<n0:ZProveerDatosPagoProveed2Response xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
<Adrnr>0000</Adrnr>
<Bankk>0000</Bankk>
<Bankn>0000</Bankn>
<Bkont>0000</Bkont>
<Iban>ES0000</Iban>
<KoinhFi>ROBLES AVN</KoinhFi>
<Land1>TH</Land1>
<Landx>XXXXX</Landx>
<Name1>ROBLES AVN</Name1>
<Pstlz>0000</Pstlz>
<Stcd1>A0000</Stcd1>
<Stras>ROBLES AVN</Stras>
<Swift>XXXXX</Swift>
<Text1_052>ROBLES AVN</Text1_052>
<Zterm>Z000</Zterm>
</n0:ZProveerDatosPagoProveed2Response>
</soap-env:Body>
</soap-env:Envelope>
Expected Response:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<ZProveerDatosPagoProveed2Response xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
<Adrnr>0000</Adrnr>
<Bankk>0000</Bankk>
<Bankn>0000</Bankn>
<Bkont>0000</Bkont>
<Iban>ES0000</Iban>
<KoinhFi>ROBLES AVN</KoinhFi>
<Land1>TH</Land1>
<Landx>XXXXX</Landx>
<Name1>ROBLES AVN</Name1>
<Pstlz>0000</Pstlz>
<Stcd1>A0000</Stcd1>
<Stras>ROBLES AVN</Stras>
<Swift>XXXXX</Swift>
<Text1_052>ROBLES AVN</Text1_052>
<Zterm>Z000</Zterm>
</ZProveerDatosPagoProveed2Response>
I got little Problems with my generated code:
here the XML Structure that i need to have:
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<soapenv:Envelope xmlns:v1="http://openclinica.org/ws/study/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="soapenc" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-27777511" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>xxxx</wsse:Username>
<wsse:Password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxxxxx</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:listAllRequest/>
</soapenv:Body>
</soapenv:Envelope>
and hereĀ“s my Code that i have done:
declarePrefix("v1", NAMESPACE);
getBody().addTextNode(null, METHOD_NAME, "?");
XMLParentNode security = new XMLParentNodeImpl(HEADER_NAMESPACE, "Security");
security.addAttribute(HEADER_NAMESPACE,"mustUnderstand", "1");
XMLParentNode usernameToken = new XMLParentNodeImpl(UNT_NAMESPACE, "UsernameToken");
usernameToken.addTextNode(null, "wsse:Username", "root");
usernameToken.addTextNode(PASSTYPE, "wsse:Password", Constants.OC_PASSWORD);
security.addElement(usernameToken);
getHeader().addElement(security);
but the output looks like:
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<soapenv:Envelope xmlns:v1="http://openclinica.org/ws/study/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<n0:Security n0:mustUnderstand="1" xmlns:n0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<n1:UsernameToken xmlns:n1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>xxxx</wsse:Username>
<n2:wsse:Password xmlns:n2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxxxxx</n2:wsse:Password>
</n1:UsernameToken>
</n0:Security>
</soapenv:Header>
<soapenv:Body>
<listAllRequest>?</listAllRequest>
</soapenv:Body>
</soapenv:Envelope>
you see i have some trouble with the lines
<n0:Security....
<n1:UsernameToken...
<n2:wsse:Password...
how can i change the n0,n1 etc... not just in the beginn of the line specialy on the tags like n0:mustUnderstand="1"
i tryed to declare prefixes etc but nothing changes tis object.
Can someone tell with what method i can change this things
Thanks a lot for helping
Christian
for all intrestet Users, i solved it that way:
declarePrefix("v1", NAMESPACE);
declarePrefix("soapenc", "soapenc");
getBody().addTextNode(null, METHOD_NAME, "?");
XMLParentNode security = new XMLParentNodeImpl(null, "wsse:Security");
security.declarePrefix("wsse", HEADER_NAMESPACE);
security.addAttribute(HEADER_NAMESPACE,"mustUnderstand", "1");
XMLParentNode usernameToken = new XMLParentNodeImpl(null, "wsse:UsernameToken");
usernameToken.declarePrefix("wsu", UNT_NAMESPACE);
usernameToken.addAttribute(null, "wsu:Id", "UsernameToken-27777511");
usernameToken.addTextNode(null, "wsse:Username", Constants.OC_Username);
usernameToken.addTextNode(null, "wsse:Password", Constants.OC_PASSWORD);
security.addElement(usernameToken);
getHeader().addElement(security);
the results not 100% simular to my outgoing code, but the request are working :)
I generate a Web Service Client with the assistant of Eclipse passing the WSDL of the provider Web Service.
I generate in a JUnit test case the object to pass to the Web Service.
//After set properties of the request object
AbacusWebService wsAbacus = new AbacusWebService();
WebServiceResult wsResult = wsAbacus.irsValoration(requestObject);
With the monitor TCP-IP of Eclipse I see the the request and the response and both are correct. The response returns data:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<irsValorationResponse xmlns="http://webServices.isban.es">
<irsValorationReturn>
<error xsi:nil="true"/>
<format>dd/MM/yyyy</format>
<pricingDate>02/09/2012</pricingDate>
<results>
<results>
<bpv>-492.6493116525817</bpv>
<cer xsi:nil="true"/>
<chargeRunning xsi:nil="true"/>
<chargeUpfront xsi:nil="true"/>
<error xsi:nil="true"/>
<gamma>0.004649336915463209</gamma>
<gammaTotal xsi:nil="true"/>
<minCerReturn xsi:nil="true"/>
<name>IRS</name>
<npv>46371.877687584296</npv>
<payingNpv>0.0</payingNpv>
<pricingDelta>433.0423619134596</pricingDelta>
<receivingNpv>46371.877687584296</receivingNpv>
<swapRate>0.9412756009346844</swapRate>
</results>
</results>
</irsValorationReturn>
</irsValorationResponse>
</soapenv:Body>
But when I inspect the response object (wsResult), all of their properties are null.
Can anyone help me?
Thanks in advance.