I am trying to consume a service .
Can any one help me how to generate a soap request as follows.
i want to construct a class and then serialize the class using soap formator and then post it to my service. I tried with the some online help but could not able to generate the required soap xml.
i am bit confused about the implementation .Can any one help me on this.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:iot="http://services.singp.com>
<soapenv:Header/>
<soapenv:Body>
<iot.performService>
<iot.input>
<iot.gsh><![CDATA[
<header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://services.singp.com">
<GUID></GUID>
<CustID></CustID>
<RequestName></RequestName>
<TimeStamp>2017-06-09T10:49:03.49-05:00</TimeStamp>
</header>
]]></iot.gsh>
<iot.Body><![CDATA[
<CustStatus xmlns="http://services.singp.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CustStatusAttributes>
<CustID>str1234</CustID>
<Action>str1234</Action>
</CustStatusAttributes>
<CustStatusInformation>
<ClientOrderNumber>745</ClientOrderNumber>
</CustStatusInformation>
</CustStatus>
]]></iot.Body>
</iot.input>
</iot.performService>
</soapenv:Body>
</soapenv:Envelope>
Related
How to get xmlnodelist of OriginDestinationOptions which is having exact two OriginDestinationOption.
<?xml version="1.0" encoding="utf-8"?>
<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>
<OTA_AirPriceRS xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:ns1="http://www.opentravel.org/OTA/2003/05">
<ns1:PricedItinerary ApplyMarkup="Y" FareType="Refundable" LFSPRICEDIFF="0" MatrixFare="" OriginDestinationRPH="DELBOMG8346G820160520BOMDELG8329G820160522" OriginDestinationRefNumber="2" ReturnOnly="true" SequenceNumber="" SupplierSystem="G8CP" isTBF="false">
<ns1:AirItinerary FareType="Refundable" SupplierCode="G8CP" SupplierSystem="G8CP" TripType="" UniqueIdentifier="1">
<ns1:OriginDestinationOptions WorkFlow="PFB">
<ns1:OriginDestinationOption>
</ns1:OriginDestinationOption>
<ns1:OriginDestinationOption>
</ns1:OriginDestinationOption>
</ns1:AirItinerary>
</OTA_AirPriceRS>
</soapenv:Body>
</soapenv:Envelope>
The XPath would be as follow :
//ns1:OriginDestinationOptions[count(ns1:OriginDestinationOption)=2]
Make sure to register the prefix ns1 to an XmlNamespaceManager and don't forget to pass the namespace manager to SelectNodes() or SelectSingleNode() (whichever you use to execute the XPath).
I have a SOAP message like following:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:SaveMethod xmlns:ns1="urn:MyService" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<data xsi:type="xsd:string">
<![CDATA[
<?xml version='1.0' encoding='iso-8859-1'?>
<test>123</test>
]]>
</data>
</ns1:SaveMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My WCF is working fine when the SaveMethod tag is without prefix e.g.
<SaveMethod>
<data xsi:type="xsd:string">
etc.
But since i am not able to edit the SOAP message i need to find out how to make the SaveMethod accept the tag with prefix ns1.
Btw my method is as follows:
public void SaveMethod(String data){
// do something
}
Maybe i can do something on the client-side (HttpWebRequest used btw) ??
Thank you very much
Is it possible to remove the what appears to be automatic notificationRequestResponse node from the response?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
...
<soap:Body>
<notificationRequestResponse xmlns="...">
<notificationResponse xmlns="...">
<success xmlns="">boolean</success>
<fault xmlns="">
...
</fault>
</notificationResponse>
</notificationRequestResponse>
</soap:Body>
</soap:Envelope>
I need to return the below:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
...
<soap:Body>
<notificationResponse xmlns="...">
<success xmlns="">boolean</success>
<fault xmlns="">
...
</fault>
</notificationResponse>
</soap:Body>
</soap:Envelope>
I want the notificationResponse to be the root of the response!
The WebMethod currently has no logic but:
return new notificationResponse()
Where is the notificationRequestResponse coming from? I can rename it using WebMethod SoapDocumentMethod(ResponseElementName="new name") but I want it gone. Working to a provided spec and have no choice.
Appreciated.
Found the answer...
SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)
I have below Soap response XML string
<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>
<qu:quotationResponse xmlns:qu="http://Reliance_RENEWAL_Quotation/IRenewal_Quotation">
<response><?xml version="1.0" encoding="UTF-8"?>
<RENEWAL-QUOTATION-RESPONSE>
<MESSAGE-DATA>
<ContractType>XYZ </ContractType>
<PremiumAmount>10000</PremiumAmount>
<PremiumSuspense>0.0</PremiumSuspense>
<NetAmmount>10000.0</NetAmmount>
<ContractPremiumStatus>Surrender </ContractPremiumStatus>
<ContractOwnerClientNumber>0501234</ContractOwnerClientNumber>
<OwnerName>SUDZ</OwnerName>
<LifeAssuredClientNumber>12312312</LifeAssuredClientNumber>
<LifeAssuredName>SUDZ </LifeAssuredName>
<PaidTodate>20110731</PaidTodate>
<ReinstatementFee>0.0</ReinstatementFee>
<ContractNumber>1122112211</ContractNumber>
</MESSAGE-DATA>
<ERROR-DETAILS>
<ErrorCode>No Errors</ErrorCode>
<ErrorDesc></ErrorDesc>
</ERROR-DETAILS>
</RENEWAL-QUOTATION-RESPONSE>
</response>
</qu:quotationResponse>
</soapenv:Body>
</soapenv:Envelope>
I need the value of ContractType, NetAmount etc
I tried but not able to parse.
What is best the way to parse above xml.
Please help.
I have a problem with some calls to a web service:
When I create the SoapEnveloper I put this on the wire
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:GetUserIDByName>
<tem:sUser>sample</tem:sUser>
<tem:oParam>
<tem:CountryURL>US</tem:CountryURL>
<tem:noCache>false</tem:noCache>
</tem:oParam>
</tem:GetUserIDByName>
</soapenv:Body>
</soapenv:Envelope>
But the response comes as:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:16092960528611E1BFADB7181697B03B</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
<wsa:ReferenceParameters>
<instra:tracking.ecid xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">0000JLUJsMq0VsSqyCBh6G1FCdSn000GYf</instra:tracking.ecid>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
</env:Header>
<env:Body>
<GetUserIDByNameResponse xmlns="http://tempuri.org/">
<Error>
<ErrorCode>0</ErrorCode>
<ErrorMessage>''</ErrorMessage>
</Error>
<ReturnValue>0</ReturnValue>
<GetUserIDByNameResult>9815</GetUserIDByNameResult>
</GetUserIDByNameResponse>
</env:Body>
</env:Envelope>
Now the autogenerated proxy classes for this service call has the following attribute:
[SoapDocumentMethodAttribute("http://tempuri.org//GetUserNameById",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
corresponding to the default namespace.
The problem seems that the de-serialization process does not seem to understand the response.
Any idea on how to fix this?