I'm building a Web Service in C# with VS2008, and want to implement WS-Addressing, so the message headers look like eg below:
What do I need to add / do in VS2008 to make this happen?
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<soap:Header>
<wsa:To>http://messagehandler.org.com/sendmessage</wsa:To>
<wsa:ReferenceParameters>
</wsa:ReferenceParameters>
<wsa:From>
<wsa:EndpointReference>
<wsa:Address>http://www.thirdparty.com/address</wsa:Address>
</wsa:EndpointReference>
</wsa:From>
<wsa:Action>http://www.org.com/ServiceName</wsa:Action>
<wsa:MessageID>urn:uuid:18367C02-8286-487b-9D35-D2EDC974ACF8</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:346CC216-5C14-496d-B6EA-7B644CAF6D48</wsa:RelatesTo>
<wsse:Security>
</wsse:Security>
</soap:Header>
Related
I need to send an custom header mentioned below and get response from the proxy client. could some please share some basic sample code to achive the same.
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ses="http://xml.amadeus.com/2010/06/Session_v3">
<soap:Header>
<add:MessageID xmlns:add="http://www.w3.org/2005/08/addressing">0685482c-7f32-46b6-b27f-3149935b9307</add:MessageID>
<add:Action xmlns:add="http://www.w3.org/2005/08/addressing">http://webservices.amadeus.com/Hotel_MultiSingleAvailability_10.0</add:Action>
<add:To xmlns:add="http://www.w3.org/2005/08/addressing">https://noded5.test.webservices.amadeus.com/1ASIWPOC1A</add:To>
<link:TransactionFlowLink xmlns:link="http://wsdl.amadeus.com/2010/06/ws/Link_v1" />
<oas:Security xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<oas:UsernameToken xmlns:oas1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" oas1:Id="UsernameToken-1">
<oas:Username></oas:Username>
<oas:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">RjJmUSsjczI=</oas:Nonce>
<oas:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">ZmJhZTdhY2E0YzdkYjIyODFkNDY2Y2RjZDYxN2MyZDlkYTE5NWJkYg==</oas:Password>
<oas1:Created>2022-09-08T18:27:59.86Z</oas1:Created>
</oas:UsernameToken>
</oas:Security>
<AMA_SecurityHostedUser xmlns="http://xml.amadeus.com/2010/06/Security_v1">
<UserID AgentDutyCode="SU" POS_Type="1" PseudoCityCode="" RequestorType="U" />
</AMA_SecurityHostedUser>
</soap:Header>
</soap:Envelope>
I have created a wcf client that makes a request to get the data.
When i made a call to service, the request itself not created.
I am sending all the header information to the service and it is not sending a request.
The request is using SOAP,
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext- 1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<VisSvcHeaders xmlns="http://dai.es.VisSvc/2010/svc">
<packNGo>false</packNGo>
</VisSvcHeaders>
<wsa:Action>http://vissvc.esi.daimler.com/2010/svc/getData</wsa:Action>
<wsa:From>
<wsa:Address>Vis</wsa:Address>
</wsa:From>
<wsa:MessageID>urn:uuid:795b9745-4867-4f05-af5a- 87704920a6dd</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://vissvc.e.corpintra.net/VisSvcNative/DAIESIVisService</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-6bf652ad-6f2e-4312-ae4f-5807c5f21e38">
<wsu:Created>2014-02-19T08:41:48Z</wsu:Created>
<wsu:Expires>2014-02-19T08:46:48Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<getData xmlns="http://dai.esi.VisSvc/2010/svc">
<part xmlns="">
<number xmlns="http://dai.es.VisSvc/2010/bo">43</number>
<referenceConfiguration xmlns="http://dai.esi.VisSvc/2010/bo">
<lifecycle xmlns="">Rel</lifecycle>
</referenceConfiguration>
<mode xmlns="http://dai.es.VisSvc/2010/bo">open</mode>
</part>
</getData>
</soap:Body>
How can I send the request as this, and the code I am using is,
ServiceReference2.ServicePortTypeClient svc = new ServiceReference2.ServicePortTypeClient();
WebRequest request = WebRequest.Create("http://vissvc- test.e.intra.net/SvcNative/VisService");
ServiceReference2.PartType part = new ServiceReference2.PartType();
part.number = "43";
ServiceReference2.ResponseType res = svc.getData(part);
Console.WriteLine(res);
This request of getData() is not sending or creating a request of this sort.
I am using .net c# 4.0.
I have downloaded WsdlUI, a open source C# SOAP client that is able to consume and process WCF messages without needing to add a reference. I can post to a method that has simple types(like strings and ints). When the WCF method has a complex type the XML envelope is incorrect. I am somewhat a noob to WCF and am a little lost with all the code... someone please help; how do I get the XML to return the correct XML?
I enabled tracing on my server and here is the valid xml envelope from a console app that has the service reference added:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://host.com/BG.WCF/Service.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/MobileInterface/CreateQueuedMsg</Action>
</s:Header>
<s:Body>
<CreateQueuedMsg xmlns="http://tempuri.org/">
<Token>add568d9-45e0-0000-98a5-762b84989797</Token>
<BGSMSMessage xmlns:a="http://schemas.datacontract.org/2004/07/BG.Bus.Mobile.Classes" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:BusinessID>Test</a:BusinessID>
<a:CommsGUID>eca403e7-1116-4bc3-a476-31e91c4ca33f</a:CommsGUID>
<a:DestinationAddress>+27000000000</a:DestinationAddress>
<a:Msg>test msg</a:Msg>
<a:MsgEncodingType>Default</a:MsgEncodingType>
<a:SendDT>2014-02-24T07:21:45.3187492+02:00</a:SendDT>
<a:SystemID>Test</a:SystemID>
<a:ValidityDT>2014-02-27T07:21:45.3187492+02:00</a:ValidityDT>
</BGSMSMessage>
<smsRoute xmlns:a="http://schemas.datacontract.org/2004/07/BG.Bus.Mobile.Classes" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:SMSRoute>BGWASP</a:SMSRoute>
</smsRoute>
</CreateQueuedMsg>
</s:Body>
here is the envelope WsdlUi returns:
<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/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://bgvm08mbl01.businessgenetics.co.za/BG.Bus/BG.Bus.Mobile.WCF/MobileService.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/MobileInterface/CreateQueuedMsg</Action>
</s:Header>
<soap:Body>
<CreateQueuedMsg xmlns="http://tempuri.org/">
<Token>ADD568D9-45E0-498E-98A5-762B84989797</Token>
<BGSMSMessage>
<BusinessID>Test</BusinessID>
<CommsGUID>559eb322-7b01-438d-93f1-74b1aafccc4f</CommsGUID>
<DestinationAddress>0000000000</DestinationAddress>
<Msg>Testers2014-02-24 07:37:53</Msg>
<MsgEncodingType>Default</MsgEncodingType>
<SendDT>2014-02-24 07:37:53</SendDT>
<SystemID>Test</SystemID>
<ValidityDT>2014-02-27 07:37:53</ValidityDT>
</BGSMSMessage>
<smsRoute>
<SMSRoute>BGWASP</SMSRoute>
<SMSRoute>GV</SMSRoute>
</smsRoute>
</CreateQueuedMsg>
</soap:Body>
I am the developer of WsdlUI so thanks for using it.
The application currently does not work with complex types due to the bug that you are referring to.
I should have a release out mid June that will fix this problem.
Thanks for the detailed description of the problem in your post.
I want to get a list of AdWords clients assigned to authenticated account (i use OAuth).
First attempt was to use ServicedAccountService and this XML request
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<RequestHeader xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
<developerToken xmlns="https://adwords.google.com/api/adwords/mcm/v201109">[[DEV_TOKEN]]</developerToken>
</RequestHeader>
</soap:Header>
<soap:Body>
<get xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
<selector>
<enablePaging>false</enablePaging>
</selector>
</get>
</soap:Body>
</soap:Envelope>
But it works only for MCC accounts. For regular google account i got empty dataset
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
<ns2:requestId>0004bc71cee633d00aecb0aa000060ca</ns2:requestId>
<ns2:serviceName>ServicedAccountService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>0</ns2:operations>
<ns2:responseTime>230</ns2:responseTime>
<ns2:units>0</ns2:units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<getResponse xmlns="https://adwords.google.com/api/adwords/mcm/v201109" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109">
<rval>
<accounts>
<customerId>0</customerId>
<canManageClients>false</canManageClients>
</accounts>
</rval>
</getResponse>
</soap:Body>
</soap:Envelope>
I googled a lot, and finally found that i can use other XML (InfoService) for both MCC and non MCC accounts.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<RequestHeader xmlns="https://adwords.google.com/api/adwords/info/v201109">
<developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[DEV_TOKEN]]</developerToken>
</RequestHeader>
</soap:Header>
<soap:Body>
<get xmlns="https://adwords.google.com/api/adwords/info/v201109">
<selector>
<dateRange>
<min xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[START_DATE]]</min>
<max xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[END_DATE]]</max>
</dateRange>
<includeSubAccounts>true</includeSubAccounts>
<apiUsageType>UNIT_COUNT_FOR_CLIENTS</apiUsageType>
</selector>
</get>
</soap:Body>
</soap:Envelope>
But data returned is incorrect - not all accounts are listed. Or no data returned at all.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
<ns2:requestId>0004bc7121a910e80a97030d000051e7</ns2:requestId>
<ns2:serviceName>InfoService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>1206</ns2:responseTime>
<ns2:units>1</ns2:units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<getResponse xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
<rval>
<cost>0</cost>
</rval>
</getResponse>
</soap:Body>
</soap:Envelope>
Is there any other way to get client list for AdWords account? Thanks a lot.
I've also encountered this problem, and can confirm that it's not the correct behaviour of the ServicedAccountService; it's a "known issue that will be resolved in future": If you link your basic account to an MCC, then you can authenticate with the basic account and use the ServicedAccountService to obtain the account details, but if the account isn't linked then you'll get this problem.
If you just want to obtain the customer id for an account, you can also use the InfoService, which doesn't suffer from the same issue.
I'm trying to write a SOAPpy client to my C# WebService. It is arriving as null :(
How can I get any debug from the C# SOAP parser that WebService uses?
This is what Python sends:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<ns1:UpdateSession xmlns:ns1="http://www.xlogic.pl/SENACA" SOAP-ENC:root="1">
<xsd:Session>
<ID xsi:type="xsd:int">420</ID>
<RecordCreationTime SOAP-ENC:arrayType="xsd:ur-type[6]" xsi:type="SOAP-ENC:Array">
<item xsi:type="xsd:int">2010</item>
<item xsi:type="xsd:int">8</item>
<item xsi:type="xsd:int">17</item>
<item xsi:type="xsd:int">11</item>
<item xsi:type="xsd:int">13</item>
<item xsi:type="xsd:double">21.0</item>
</RecordCreationTime>
<ASP_SessionID xsi:type="xsd:string">92072674A04CB88D62776EA7</ASP_SessionID>
<LangID xsi:type="xsd:string">fr-FR</LangID>
<OneTimeKey xsi:type="xsd:string">a334cea18e014f4d8d04</OneTimeKey>
</xsd:Session>
</ns1:UpdateSession>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This is what C# expects
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.xlogic.pl/SENACA"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<tns:UpdateSession>
<s href="#id1"/>
</tns:UpdateSession>
<tns:Session id="id1" xsi:type="tns:Session">
<ID xsi:type="xsd:int">int</ID>
<RecordCreationTime
xsi:type="xsd:dateTime">dateTime</RecordCreationTime>
<ASP_SessionID xsi:type="xsd:string">string</ASP_SessionID>
<LangID xsi:type="xsd:string">string</LangID>
<OneTimeKey xsi:type="xsd:string">string</OneTimeKey>
</tns:Session>
</soap:Body>
</soap:Envelope>
Not a Python answer, but soapUI is a very useful facility for debugging and automated testing of web services. I used it heavily on a C# WCF project, with a variety of clients, including Python, Boo, Java, and C#.