missing prefix in soap request c# dynamic web request - c#

I´m using the WsdlImporter to read a wsdl-file and create a dynamic web request. But if I create the request a prefix in my request is missing and the consuming web service can not handle with this request. How can I force, that the prefix will be set?
This is how the request should be:
<?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:urn="urn:sap-com:document:sap:rfc:functions>
<soap:Body>
<urn:K23G_GET_COST_ELEMENTS>
<ID_BEKNZ xmlns="">S</ID_BEKNZ>
<ID_COLLECT_MESSAGES xmlns="">X</ID_COLLECT_MESSAGES>
<ID_GJAHR xmlns="">2016</ID_GJAHR>
<ID_KOKRS xmlns="">K001</ID_KOKRS>
<ID_VERSN xmlns="">000</ID_VERSN>
<ID_WRTTP xmlns="">04</ID_WRTTP>
<ET_MESG xmlns="">
<item />
</ET_MESG>
<ET_RESULTS xmlns="">
<item />
</ET_RESULTS>
<IT_COSEL_KSTAR xmlns="">
<item />
</IT_COSEL_KSTAR>
<IT_COSEL_OBJ xmlns="">
<item />
</IT_COSEL_OBJ>
</urn:K23G_GET_COST_ELEMENTS>
</soap:Body>
</soap:Envelope>
An this is how the request looks like:
The urn before K23G_GET_COST_ELEMENTS is missing
<?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">
<soap:Body>
<K23G_GET_COST_ELEMENTS xmlns:urn="urn:sap-com:document:sap:rfc:functions>
<ID_BEKNZ xmlns="">S</ID_BEKNZ>
<ID_COLLECT_MESSAGES xmlns="">X</ID_COLLECT_MESSAGES>
<ID_GJAHR xmlns="">2016</ID_GJAHR>
<ID_KOKRS xmlns="">K001</ID_KOKRS>
<ID_VERSN xmlns="">000</ID_VERSN>
<ID_WRTTP xmlns="">04</ID_WRTTP>
<ET_MESG xmlns="">
<item />
</ET_MESG>
<ET_RESULTS xmlns="">
<item />
</ET_RESULTS>
<IT_COSEL_KSTAR xmlns="">
<item />
</IT_COSEL_KSTAR>
<IT_COSEL_OBJ xmlns="">
<item />
</IT_COSEL_OBJ>
</urn:K23G_GET_COST_ELEMENTS>
</soap:Body>
</soap:Envelope>
Somebody there who can help me?
Thank you

Related

How can i get the sharedmailbox mails from EWS api?

I am able to get the sharedmailbox mail by this C# code but I want api for the same .Is EWS server provide so .
FolderId SharedMailbox = new FolderId(WellKnownFolderName.Inbox,"Shared#domain.com");
ItemView itemView = new ItemView(1000);
service.FindItems(SharedMailbox,itemView);
I see there is something which give me my mailbox details
https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/findconversation-operation
<?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/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP1" />
</soap:Header>
<soap:Body>
<m:FindConversation>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="1" Offset="0"/>
<m:ParentFolderId>
<t:DistinguishedFolderId Id ="inbox"/>
</m:ParentFolderId>
</m:FindConversation>
</soap:Body>
</soap:Envelope>
I want same like for my shared mailbox mails.
Is there is any api same like this for shared mailbox mail?
You can use this. You can mention shared mailbox like this.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<m:FindConversation>
<m:IndexedPageItemView MaxEntriesReturned="1" Offset="0" BasePoint="End" />
<m:ParentFolderId>
<t:DistinguishedFolderId Id="inbox" >
<t:Mailbox>
<t:EmailAddress>sharedmail#mail.com</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</m:ParentFolderId>
</m:FindConversation>
</soap:Body>
</soap:Envelope>

Exchange Soap Update notes contact?

I was unable to execute a Soap Exhange request to update contacts:PersonalNotes .
I have not found documentation on msdn: https://msdn.microsoft.com/en-us/library/office/ee693002(v=exchg.80).aspx
this is my soap code:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="Eastern Standard Time" />
</t:TimeZoneContext>
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly"
ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId
Id="AAMkAD...QAAAz9hI5AAA=" ChangeKey="EQAAAB...QAAAz9rdN" />
<t:Updates>
<t:SetItemField>
<t:FieldURI FieldURI="contacts:Notes" />
<t:Contact>
<t:Notes>TEST N</t:Notes>
</t:Contact>
</t:SetItemField>
</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>
this the error displayed:
What is the soap code to write to edit the Contact PersonalNotes ?
The Notes field in a Contact is the Body Property of a Message so to update you need to update the body eg
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId Id="AAMkADczN=" ChangeKey="EQAAABYAAAB1EEf9R" />
<t:Updates>
<t:SetItemField>
<t:FieldURI FieldURI="item:Body" />
<t:Contact>
<t:Body BodyType="Text">test text</t:Body>
</t:Contact>
</t:SetItemField>
</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>

remove namespaces, attributes, Xsi from Soap response using code or XSLT

Remove namespaces, attributes, Xsi from Soap response using code or XSLT
Want to transform a soap response to a normal XML(without namespaces, atributes) using C# code (Serializer, XMLDoc, XDoc ) or XSLT.
here is the soap response.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:Magento"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:catalogProductInfoResponse>
<info xsi:type="ns1:catalogProductReturnEntity">
<product_id xsi:type="xsd:string">3459</product_id>
<sku xsi:type="xsd:string">HK-BP001</sku>
<categories SOAP-ENC:arrayType="xsd:string[0]" xsi:type="ns1:ArrayOfString"/>
<websites SOAP-ENC:arrayType="xsd:string[7]" xsi:type="ns1:ArrayOfString">
<item xsi:type="xsd:string">1</item>
</websites>
<created_at xsi:type="xsd:string">2016-04-19 01:45:35</created_at>
<has_options xsi:type="xsd:string">1</has_options>
<special_from_date xsi:type="xsd:string">2016-04-19 00:00:00</special_from_date>
<tier_price SOAP-ENC:arrayType="ns1:catalogProductTierPriceEntity[0]" xsi:type="ns1:catalogProductTierPriceEntityArray"/>
<custom_design xsi:type="xsd:string">ultimo/default</custom_design>
<enable_googlecheckout xsi:type="xsd:string">1</enable_googlecheckout>
</info>
</ns1:catalogProductInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
i want transformed xml like :
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Body>
<catalogProductInfoResponse>
<info>
<product_id>3459</product_id>
<sku>HK-BP001</sku>
<categories/>
<websites>
<item>1</item>
</websites>
<created_at>2016-04-19 01:45:35</created_at>
<has_options>1</has_options>
<special_from_date>2016-04-19 00:00:00</special_from_date>
<tier_price/>
<custom_design>ultimo/default</custom_design>
<enable_googlecheckout>1</enable_googlecheckout>
</info>
</catalogProductInfoResponse>
</Body>
</Envelope>
You can use XSLT:
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

soap service The specified type was not recognized

Can anyone tell me why I get:
{"The specified type was not recognized: name='anyType', namespace='http://www.mywebsite.com/webservice/service.wsdl', at <response xmlns=''>."}
And the xml that I'm getting is:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.mywebsite.com/webservice/service.wsdl" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:getCarsResponse>
<response SOAP-ENC:arrayType="ns1:anyType[2]" xsi:type="ns1:carlist">
<item xsi:type="SOAP-ENC:Struct">
<id xsi:type="xsd:string">1392</id>
<merk xsi:type="xsd:string">Citroen</merk>
<type xsi:type="xsd:string">C1</type>
<uitvoering xsi:type="xsd:string">1.0i Selection 5D</uitvoering>
<leaseprijs xsi:type="xsd:string">299,--</leaseprijs>
<looptijd xsi:type="xsd:string">18</looptijd>
<kilometrage xsi:type="xsd:string">25.000</kilometrage>
<thumbnail xsi:type="xsd:string">/i_upload/free/_th.gif</thumbnail>
</item>
<item xsi:type="SOAP-ENC:Struct">
<id xsi:type="xsd:string">1393</id>
<merk xsi:type="xsd:string">Citroen</merk>
<type xsi:type="xsd:string">C1</type>
<uitvoering xsi:type="xsd:string">1.0i Selection 5D</uitvoering>
<leaseprijs xsi:type="xsd:string">299,--</leaseprijs>
<looptijd xsi:type="xsd:string">18</looptijd>
<kilometrage xsi:type="xsd:string">25.000</kilometrage>
<thumbnail xsi:type="xsd:string">/i_upload/free/_th.gif</thumbnail>
</item>
</response>
</SOAP-ENV:getCarsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I invoke the SOAP service in this way:
Service.service_portClient proxy = new Service.service_portClient();
proxy.getCars("Citroen", benzine);

SOAPpy, C# and object passing

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#.

Categories

Resources