Karate 0.9.1 is throwing exceptions for soap webservice testing - karate

I'm trying to test soap webservices using Karate 0.9.1, I created the scenario as per the documentation.
But yet i get exception when i test the soap webservices when passing the webservice request in the test scenario.
Scenario : 1
I passed the request as below,
* def req=
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
<ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
Result
“[Fatal Error] :32:18: XML document structures must start and end within the same entity”
Scenario : 2
Given request
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
<ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
Result
“[Fatal Error] :32:18: XML document structures must start and end within the same entity”
Scenario : 3
Given request =
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
<ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
Result
Program execution freezes and no output
Can anyone help me understand what i'm doing wrong here.
I used the same xml in Karate 0.6.1 and it is working fine.

Just have the triple-quotes on a separate line and you should be fine:
* def req =
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1"> <ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
* print req
We had asked users to test the beta releases but looks like you haven't seen them: https://twitter.com/KarateDSL/status/1064375506202755073
Anyway, if you still see issues like "freezes" please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Related

How to write SQL inside XML SOAP request - salesforce marketing cloud API

I am new to SOAP.
I am trying to get the Send Object information and I am able to pull all the data I need except
SendID
This is the request I make in postman
<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:Header>
<fueloauth>{{sf_ps_access_token}}</fueloauth>
</soapenv:Header>
<soapenv:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>ID</Properties>
<Properties>BCCEmail</Properties>
<Properties>SendID</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>PartnerKey</Properties>
<Properties>CreatedDate</Properties>
<Properties>ModifiedDate</Properties>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>Email.PartnerKey</Properties>
<Properties>SendDate</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>Duplicates</Properties>
<Properties>InvalidAddresses</Properties>
<Properties>HardBounces</Properties>
<Properties>SoftBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>UniqueClicks</Properties>
<Properties>UniqueOpens</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>NumberTargeted</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>Unsubscribes</Properties>
<Properties>MissingAddresses</Properties>
<Properties>Subject</Properties>
<Properties>PreviewURL</Properties>
<Properties>SentDate</Properties>
<Properties>EmailName</Properties>
<Properties>Status</Properties>
<Properties>EmailSendDefinition.ObjectID</Properties>
<Properties>EmailSendDefinition.CustomerKey</Properties>
<Properties>Client.PartnerClientKey</Properties>
<Properties>Email.PartnerKey</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>CreatedDate</Property>
<SimpleOperator>between</SimpleOperator>
<DateValue>2018-01-01</DateValue>
<DateValue>2021-12-09</DateValue>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
This is the error I am getting:
Error: Column 'dbo.tblJobs.SendID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
How do I write SQL inside the xml SOAP request?
My response on this one is late. I think the problem is ,
In Send object (<ObjectType>Send</ObjectType>) there is no field as SendID. If you need Job Id inorder to connect other tracking, you need to use "ID" attribute. You can further improve using BatchId
SendID is present in other event like clicks or open. You can use SendId in those event for filtering the data
Sample message for getting send info :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>Send</ObjectType>
<Properties>Client.ID</Properties>
<Properties>Email.ID</Properties>
<Properties>EmailName</Properties>
<Properties>Subject</Properties>
<Properties>SendDate</Properties>
<Properties>CreatedDate</Properties>
<Properties>Status</Properties>
<Properties>FromAddress</Properties>
<Properties>FromName</Properties>
<Properties>ID</Properties>
<Properties>NumberSent</Properties>
<Properties>NumberDelivered</Properties>
<Properties>ForwardedEmails</Properties>
<Properties>NumberErrored</Properties>
<Properties>NumberExcluded</Properties>
<Properties>ExistingUndeliverables</Properties>
<Properties>ExistingUnsubscribes</Properties>
<Properties>SoftBounces</Properties>
<Properties>HardBounces</Properties>
<Properties>OtherBounces</Properties>
<Properties>Unsubscribes</Properties>
<Properties>UniqueOpens</Properties>
<Properties>UniqueClicks</Properties>
<Properties>PreviewURL</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>ID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>10000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>
Once you have the JobId(ID) from above , you can use it to get other tracking .
Using the job Id to get all related sent tracking :
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{AccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Options>
</Options>
<RetrieveRequest>
<ObjectType>SentEvent</ObjectType>
<Properties>Client.ID</Properties>
<Properties>SubscriberKey</Properties>
<Properties>EventDate</Properties>
<Properties>SendID</Properties>
<Properties>BatchID</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>SendID</Property>
<SimpleOperator>between</SimpleOperator>
<Value>1</Value><Value>9000</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>

(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator?

(Wso2 Api Manager 2.6.0) How to send a list of string as input using mediator?
I have a Api and my api have a list of string for input.
my api is soap.
I think mediator can help me.
I want a mediator for this api.
for example this is my input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header/>
<soapenv:Body>
<tem:GetData>
<!--Optional:-->
<tem:value>
<!--Zero or more repetitions:-->
<arr:string>a</arr:string>
<arr:string>s</arr:string>
<arr:string>f</arr:string>
</tem:value>
</tem:GetData>
</soapenv:Body>
</soapenv:Envelope>
and this is my output
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetDataResponse xmlns="http://tempuri.org/">
<GetDataResult>You entered: a s f</GetDataResult>
</GetDataResponse>
</s:Body>
</s:Envelope>

Not able to move a message to a specific folder in outlook addin

My outlook addin uses "ReadWriteMailbox" permission. I am trying to use makeEwsRequestAsync method and send a EWS "MoveItem" request to move the message to a specific folder. But i am getting the following errror,
"The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert the Id from EwsId to EwsLegacyId format."
Request Sent
<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">
<soap:Header>
<RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ToFolderId>
<t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADb64+wAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADcIrnw"/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AAMkAGJiNjY2ZTk1LTZkMDEtNGQyYy05M2M2LWMyZmQwMzY1M2JhMQBGAAAAAACALDzcpfeRQ7ZlsoKB0iVmBwArZr3QPuquTIplat84SmYEAEq/mAl5AAAjK9sGaxZsQpt2dmaMGjhaAADb62uqAAA="/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
Response Received
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="20" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:MoveItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:MoveItemResponseMessage ResponseClass="Error">
<m:MessageText>The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert the Id from EwsId to EwsLegacyId format.
</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:MoveItemResponseMessage>
</m:ResponseMessages>
</m:MoveItemResponse>
</s:Body>
</s:Envelope>
I am able to use the MoveItem EWS operation and move the messages to "Junk Email" folder. But i want to move messages to a specific folder created by a earlier "CreateFolder" EWS operation. The id of the folder is "AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADb64+wAAA="
Using the above id in "GetFolder" operation correctly returns the no. of items in the folder. But I am not able to get the "MoveItem" operation to work. All the EWS operations are performed via the "makeEwsRequestAsync" call. Could you help with this?
Updates
CreateFolder Request:
<?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">
<soap:Header>
<RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ParentFolderId><t:DistinguishedFolderId Id="msgfolderroot"/></ParentFolderId> <Folders><t:Folder><t:DisplayName>Submissions</t:DisplayName></t:Folder></Folders>
</CreateFolder>
</soap:Body>
</soap:Envelope>
Create Folder Response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:CreateFolderResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder><t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADek+aFAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADeyyJ9"/>
</t:Folder>
</m:Folders>
</m:CreateFolderResponseMessage>
</m:ResponseMessages>
</m:CreateFolderResponse>
</s:Body>
</s:Envelope>
Move Item Request:
<?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">
<soap:Header> <RequestServerVersion Version="Exchange2013" /> </soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ToFolderId>
<t:FolderId Id="AAAbAEJhbGFrcmlzaG5hbl9SQHN5bWFudGVjLmNvbQAuAAAAAACALDzcpfeRQ7ZlsoKB0iVmAQAjK9sGaxZsQpt2dmaMGjhaAADek+aFAAA=" ChangeKey="AQAAABYAAAAjK9sGaxZsQpt2dmaMGjhaAADeyyJ9"/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AAMkAGJiNjY2ZTk1LTZkMDEtNGQyYy05M2M2LWMyZmQwMzY1M2JhMQBGAAAAAACALDzcpfeRQ7ZlsoKB0iVmBwArZr3QPuquTIplat84SmYEAEq/mAl5AAAjK9sGaxZsQpt2dmaMGjhaAADdyMHzAAA="/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
Move Item Response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1075" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:MoveItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:MoveItemResponseMessage ResponseClass="Error">
<m:MessageText>The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert the Id from EwsId to EwsLegacyId format.
</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformed</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:MoveItemResponseMessage>
</m:ResponseMessages>
</m:MoveItemResponse>
</s:Body>
</s:Envelope>
More likely your requests to "CreateFolder" and request "MoveItem" have different "RequestServerVersion". Read more on EWS schema versions in Exchange. EWS Id format has been changed I believe in "Exchange2007_SP1" version. This make me think you have used the example for "CreateFolder" request which include "RequestServerVersion" set to "Exchange2007" and it will return legacy folder Id.
EDIT:
I didn't try to reproduce your requests/response sequence, instead I used documented ways to send the following requests:
CreateFolder operation
MoveItem operation
Request to create the folder looks like ...
<?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:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
</soap:Header>
<soap:Body>
<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ParentFolderId>
<t:DistinguishedFolderId Id="msgfolderroot"/>
</ParentFolderId>
<Folders>
<t:Folder>
<t:DisplayName>Test Folder1</t:DisplayName>
</t:Folder>
</Folders>
</CreateFolder>
</soap:Body>
</soap:Envelope>
And response is ...
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1084" MinorBuildNumber="21" Version="V2017_04_14" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:CreateFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateFolderResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Folders>
<t:Folder>
<t:FolderId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwAuAAADEgGHnGK1T06Yq8xwQCjiHwEAkUJPW0th2EGwjXYeK6AWSQABv62c1AAAAA==" ChangeKey="AQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8ffU"/>
</t:Folder>
</m:Folders>
</m:CreateFolderResponseMessage>
</m:ResponseMessages>
</m:CreateFolderResponse>
</s:Body>
</s:Envelope>
The folder created successfully. As per documentation to perform MoveItem request I need the item's change key. I performed GetItem request and got the following response ...
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1084" MinorBuildNumber="21" Version="V2017_04_14" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Message>
<t:ItemId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwBGAAADEgGHnGK1T06Yq8xwQCjiHwcAkUJPW0th2EGwjXYeK6AWSQAAAgEMAAAAkUJPW0th2EGwjXYeK6AWSQABv62YlAAAAA==" ChangeKey="CQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8awE"/>
</t:Message>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>
And finally I need to move the item. The following is my request to move the item ....
<?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:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
</soap:Header>
<soap:Body>
<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<ToFolderId>
<t:FolderId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwAuAAADEgGHnGK1T06Yq8xwQCjiHwEAkUJPW0th2EGwjXYeK6AWSQABv62c1AAAAA=="/>
</ToFolderId>
<ItemIds>
<t:ItemId Id="AQMkADg0ZDZhNWFiLWE0Y2EtNDc4My05MGU1LTY5ZWNiOTQ5MmY5YwBGAAADEgGHnGK1T06Yq8xwQCjiHwcAkUJPW0th2EGwjXYeK6AWSQAAAgEMAAAAkUJPW0th2EGwjXYeK6AWSQABv62YlAAAAA==" ChangeKey="CQAAABYAAACRQk9bS2HYQbCNdh4roBZJAAG/8awE"/>
</ItemIds>
</MoveItem>
</soap:Body>
</soap:Envelope>
It is succeeded and item has been moved to my new folder.
The following are suggestions for you to proceed with your debugging ...
Look at the request how you get the itemId. The issue may be there. You need to specify the same "RequestServerVersion" to get the ChangeKey.
I suggest you to have common function for all SOAP request you do to wrap each request body. In this case you will not get in trouble with legacy data.
Something like this, very simple wrapper ...
/**
* Wrap an Exchange Web Services request in a SOAP envelope.
* #private
* #param {string} payload request XML.
* #return {string} Ready to send SOAP EWS request.
*/
function _wrapSoapEnvelope(payload) {
var result = '<?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:m="http://schemas.microsoft.com/exchange/services/2006/messages" ' +
'xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
'<soap:Header>' +
'<t:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />' +
'</soap:Header>' +
'<soap:Body>' + payload + '</soap:Body>' +
'</soap:Envelope>';
return result;
};
In this case your requests will be very simple and unified (the following 3 requests I have used for your case) ...
this.createFolderRequest = function (folderName) {
var result = '<CreateFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
'<ParentFolderId>' +
'<t:DistinguishedFolderId Id="msgfolderroot"/>' +
'</ParentFolderId>' +
'<Folders>' +
'<t:Folder>' +
'<t:DisplayName>' + folderName + '</t:DisplayName>' +
'</t:Folder>' +
'</Folders>' +
'</CreateFolder>';
return _wrapSoapEnvelope(result);
};
this.moveItemRequest = function (folderId, itemId, changeKey) {
var result = '<MoveItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">' +
'<ToFolderId>' +
'<t:FolderId Id="' + folderId + '"/>' +
'</ToFolderId>' +
'<ItemIds>' +
'<t:ItemId Id="' + itemId + '" ChangeKey="' + changeKey + '"/>' +
'</ItemIds>' +
'</MoveItem>';
return _wrapSoapEnvelope(result);
};
this.getChangeKeyRequest = function (itemId) {
var result = '<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
'<ItemShape>' +
'<t:BaseShape>IdOnly</t:BaseShape>' +
'</ItemShape>' +
'<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>' +
'</GetItem>';
return _wrapSoapEnvelope(result);
};
I suggest you check your requests as they are look different and follow Microsoft original documentation, instead of examples taken from other sources.
And this is it. The purpose of SO is QandA, not remote debugging, so you are on your own with your code issues. Please take a time to debug, clean up your code as well as read a bit more on documentation provided and you'll make it work.

Why does .NET XMLSerializer automatically change my namespace prefixes (alias)?

I am working on a web service that needs to return faults in a way that is defined by the standards of our type of business. This requires me to return a fault as this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</wsse:Security>
</soap:Header>
<soap:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I create the fault like this, but when the service sends it, it looks like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" />
</h:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Operator/operand type mismatch.</faultstring>
<faultactor>urn:dealernumberID:??????</faultactor>
<detail>
<ErrorType xmlns="http://www.starstandards.org/webservices/2009/transport">Backend Client Fault</ErrorType>
<ErrorDetail xmlns="http://www.starstandards.org/webservices/2009/transport">Backend client returned a fault</ErrorDetail>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Why does this happen? Is there a setting that I can change in .NET to keep it from doing this by default? I do understand that a namespace is a namespace regardless of the prefix, but like I said, the standard dictates we do it a certain way (most likely to accommodate third parties that are reading responses as strings?)
Thanks for any help!

How to customize operation params appearance in SOAP message?

I have WCF service with operation string GetData(DataRequest request).
When I'm calling it, request SOAP message is something like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
...
<s:Body ...>
<GetData xmlns="http://...">
<request>
...
</request>
</GetData>
</s:Body>
</s:Envelope>
And I want to customize request XML element without renaming my operation's parameter (using some attribute or so on). Is there a way to do this? And get something like this:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
...
<s:Body ...>
<GetData xmlns="http://...">
<myRequest>
...
</myRequest>
</GetData>
</s:Body>
</s:Envelope>
I've found the solution.
Attribute MessageParameter can be used to achieve desired look:
string GetData([MessageParameter(Name = "myRequest")] DataRequest request)