Content-Ids not showing up in batch response - postman

The Content-Ids I've setup in my odata batch request payload body are not showing up in the response payload body. Does anyone know what I am doing wrong or missing? I am using postman to test. I am not sure if that is a factor in this.
Sample Request:
--b2ef9c16-0c1f-47b4-942e-c5edd372bcc2
Content-Type: multipart/mixed;boundary=4df12e8f-048c-44f4-8003-1724637652e3
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 1
POST CreateChangeRequest HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
{"Init":true}
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 2
POST CustomerOrderSet(OrderNo='Z10068')/OrderLinesArray HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
X-IFS-Accept-Warnings: true
{}
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 3
POST CreateChangeRequest HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
{"Init":false}
--4df12e8f-048c-44f4-8003-1724637652e3--
--b2ef9c16-0c1f-47b4-942e-c5edd372bcc2--
Sample Response:
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
OData-Version: 4.0
Content-Length: 0
Content-Language: en-US
Content-Length: 0
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 500 Internal Server Error
OData-Version: 4.0
Content-Type: application/json
Content-Length: 208
{}
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
OData-Version: 4.0
Content-Length: 0
Content-Language: en-US
Content-Length: 0
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1--
Thanks again for your help!

Related

Setting Reply-to in mailgun

I've seen the API for this which suggests adding the Reply-To header or h:Reply-To param. I don't have any experience with headers so that may be why I'm having trouble with this.
I'm trying to construct the request in postman, and I've tried putting Reply-To as a header key and an email as the value, and I've also tried without that header and instead with a param with the key h:Reply-To but when I hit "reply" to the email that gets sent, it always replies to the sender instead of my reply-to address.
Can anyone help me?
as header
POST /v3/sandboxXXXXba.mailgun.org/messages?from=messages#xxxx.com& to=xxxx1#gmail.com& subject=hello& text=mailgun-test HTTP/1.1
Host: api.mailgun.net
Reply-To: xxxx2#gmail.com
Authorization: Basic xxxx
cache-control: no-cache
Postman-Token: xxxxx
as param
POST https://api.mailgun.net/v3/sandboxXXXX.mailgun.org/messages?from=messages#domain.com&to=me#gmail.com&subject=hello&text=mailgun-test&h:Reply-To=me#gmail.com
aka:
POST /v3/sandboxXXXXX33ba.mailgun.org/messages?from=messages#mydomain.com& to=myaddress#gmail.com& subject=hello& text=mailgun-test& h:Reply-To=myaddress#gmail.com HTTP/1.1
Host: api.mailgun.net
Authorization: Basic xxxxx
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: xxxx
Host: api.mailgun.net
Accept-Encoding: gzip, deflate
Content-Length:
Connection: keep-alive
cache-control: no-cache
So it should be a form-data body parameter:
POST /v3/skedda.co/messages HTTP/1.1
Host: api.mailgun.net
Authorization: Basic YX...
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: ...
Host: api.mailgun.net
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 781
Connection: keep-alive
cache-control: no-cache
Content-Disposition: form-data; name="from"
postmaster#...com
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="to"
a....com
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="subject"
link test
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="html"
<h1>Hello world</h1>
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="h:Reply-To"
notifications#...com
------WebKitFormBoundary7MA4YWxkTrZu0gW--
or in Postman itself

Axis Fault after request from SoapUI

I am sending a request from SoapUI and I am getting an error in return.
I have no idea how to resolve this.
Request:
POST http://localhost:8080/services/ApiService/ HTTP/1.1
Accept-Encoding: gzip,deflate
SOAPAction: ""
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Length: 345
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Response:
HTTP/1.1 500 Server Error
Set-Cookie: EZSESSIONID=y4k1kp87msmg5ni4migdd65f;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391; type="application/xop+xml"; start="<0.urn:uuid:89EA7A7AB1A241D9571457445576392#apache.org>"; start-info="text/xml"
Transfer-Encoding: chunked
Server: Jetty(7.6.3.v20120416)
--MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:89EA7A7AB1A241D9571457445576392#apache.org>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.apache.axiom.om.OMElement</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391--
ServerLog:
ERROR 2016-03-08 19:29:36.133 AxisEngine [request-19]
org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to
org.apache.axiom.om.OMElement org.apache.axis2.AxisFault:
org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to
org.apache.axiom.om.OMElement at
org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
~[axis2-kernel-1.4.1.jar:na]

gSOAP to WCF . Application/soap+xml; charset=utf-8

I have simple web service running on http://calculator.gear.host/Service1.svc
I have no problem while do call from WCF Test Client and have error while calling from gSOAP c++ client.
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"' was not the expected type 'text/xml; charset=utf-8'.
Packets on Fiddler:
WCF Test Client
Request
POST http://calculator.gear.host/Service1.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/ICalculator/GetData"
Host: calculator.gear.host
Content-Length: 158
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetData xmlns="http://tempuri.org/"><value>77</value></GetData></s:Body></s:Envelope>
gSOAP
Request
POST http://calculator.gear.host/Service1.svc HTTP/1.1
Host: calculator.gear.host
User-Agent: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"
Content-Length: 536
Connection: close
SOAPAction: "http://tempuri.org/IService1/GetData"
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns4="http://schemas.datacontract.org/2004/07/WcfService2" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData><ns1:value>55</ns1:value></ns1:GetData></SOAP-ENV:Body></SOAP-ENV:Envelope>
Answer
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"' was not the expected type 'text/xml; charset=utf-8'.
Cache-Control: private
Content-Length: 0
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Set-Cookie: ARRAffinity=7ac8ab2e2023ddbeb7d4f86322b3ed25bc003394df0030ed244a6fc5c10ec47c;Path=/;Domain=calculator.gear.host
Set-Cookie: WAWebSiteSID=9095f7410a074a959c2084564368b742; Path=/; HttpOnly
Date: Tue, 28 Jul 2015 15:03:28 GMT
Connection: close
I' have the same problem with a service not generated with gSOAP (probably using some tool in C#).
For your client gSOAP, recompile your WSDL file (soapcpp2.exe) using option -1 (generate SOAP 1.1 bindings).
This works for me.

Sitecore Item Web API - Template item not found error

I am trying to create a item via Item Web Api and I am not being able to figure out what is wrong with my call.
The template ID does exist as well as the parent ID.
POST:
POST /-/item/v1/?name=Foo&template=%23%7b57ABCEB7-25E5-4F73-88D8-9E66E79EA87C%7d%23&sc_database=master&payload=Content&fields=DataTest&sc_itemid=%23%7b110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9%7d%23 HTTP/1.1
X-Scitemwebapi-Username: sitecore\admin
X-Scitemwebapi-Password: b
Content-Type: application/x-www-form-urlencoded
Host: sandbox
Content-Length: 14
Expect: 100-continue
Proxy-Connection: Close
DataTest=Value
RESPONSE:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Date: Wed, 19 Mar 2014 00:25:34 GMT
Content-Length: 65
{"statusCode":500,"error":{"message":"Template item not found."}}
Any ideas?
Thanks a lot!
There are some extra encoded characters in the request URL, your template and sc_itemid parameters are wrapped in %23 (#) characters.
POST
/-/item/v1/?name=Foo&template=%23%7b57ABCEB7-25E5-4F73-88D8-9E66E79EA87C%7d%23&sc_database=master&payload=Content&fields=DataTest&sc_itemid=%23%7b110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9%7d%23
HTTP/1.1
Check your code to make sure how they got there but removing them should fix the issue.

Request to web service with Basic authorization via proxy with NTLM authorization not working

I have a web service that requires basic authorisation and a user behind an internet proxy that requires NTLM authorisation. I also have a forms application that makes calls to the web service and also asks the user for the web service credentials (which are different from the NTLM credentials).
I got the app configuration working (WCF ServiceModel), it's using the default proxy credentials, the request is authenticating with the proxy, but after it authenticates with the web service it does not send the request body for some reason.
The process works if I test locally without the NTLM proxy. Sorry about the long examples, but I had to include them.
1st request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Proxy-Authenticate: BASIC realm="corporaterealm"
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: close
Set-Cookie: BCSI-CS-36204A5A7BBD24D9=2; Path=/
Connection: close
Content-Length: 1057
Proxy-Support: Session-Based-Authentication
[...]
2nd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate
Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB7IIoggACAAxAAAACQAJACgAAAAFASgKAAAAD1dTUkswNDg3MENPTUVUTkVU
Host: www.myservice.com
Content-Length: 0
Receive:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAEAAQADgAAAAFgomiysOwieqrhFEAAAAAAAAAALIAsgBIAAAABQLODgAAAA9DAE8ATQBFAFQATgBFAFQAAgAQAEMATwBNAEUAVABOAEUAVAABABoAVgBJAC0AUgBJAEMASwBEAEMALQAwADAAMQAEABwAYwBvAG0AZQB0AG4AZQB0AC4AbABvAGMAYQBsAAMAOABWAEkALQBSAEkAQwBLAEQAQwAtADAAMAAxAC4AYwBvAG0AZQB0AG4AZQB0AC4AbABvAGMAYQBsAAUAHABjAG8AbQBlAHQAbgBlAHQALgBsAG8AYwBhAGwAAAAAAA==
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: Keep-Alive
Set-Cookie: BCSI-CS-36204A5A7BBD24D9=2; Path=/
Connection: Keep-Alive
Content-Length: 1074
Proxy-Support: Session-Based-Authentication
[...]
3rd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate,gzip, deflate
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAHgAAAAYABgAkAAAABAAEABIAAAADgAOAFgAAAASABIAZgAAAAAAAACoAAAABYKIogUBKAoAAAAPQwBPAE0ARQBUAE4ARQBUAFAAYQByAHMAbwBuAEoAVwBTAFIASwAwADQAOAA3ADAAlap7g+mPRMEAAAAAAAAAAAAAAAAAAAAARLAhi5lf3nd+l9xENAcu2W6xf6iJbyM6
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Basic realm="myrealm"
X-Powered-By: ASP.NET
Date: Tue, 31 May 2011 13:09:33 GMT
Cache-Control: proxy-revalidate
Content-Length: 1656
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Proxy-support: Session-based-authentication
Age: 0
[...]
4th request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate,gzip, deflate,gzip, deflate
Authorization: Basic Y29nZW50YVxjb21ldC1kbTM6Kmh0JTg2NCU=
Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB7IIoggACAAxAAAACQAJACgAAAAFASgKAAAAD1dTUkswNDg3MENPTUVUTkVU
Host: www.myservice.com
Content-Length: 0
Receive:
HTTP/1.1 400 Bad Request
Date: Tue, 31 May 2011 13:09:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private, proxy-revalidate
Content-Length: 0
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0
I don't understand why it doesn't send the envelope in the 4th request. The two handshakes are done, so theoretically everything should be fine.
When I do this locally without the NTLM proxy, the envelope gets sent as expected:
1st request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 401 Unauthorized
Content-Length: 1656
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Basic realm="myrealm"
X-Powered-By: ASP.NET
Date: Tue, 31 May 2011 13:31:46 GMT
[...]
2nd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate
Authorization: Basic Y29nZW50YVxjb21ldC1kbTM6Kmh0JTg2NCU=
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 200 OK
Date: Tue, 31 May 2011 13:31:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Set-Cookie: ASP.NET_SessionId=svv4i11awg05v1j5viz1impo; path=/; HttpOnly
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 5127
[...]
I had to change the server security configuration to accept Digest authentication. For some reason that works while Basic doesn't.
I encountered a potentially similar issue and believe in my case this may be related to the establishment of the original NTLM connection to the proxy.
In my experience I had three requests going out in sequence each hour, with a retry configured.
Of these requests two would work, one would fail with a 400, and then when the first retried it worked as well.
There is a similiar issue with IE identified here: http://blogs.msdn.com/b/asiatech/archive/2012/01/30/400-bad-request-when-posting-webservice-or-wcf-request-from-ie.aspx
I ran some network traces and watched the behaviour and noticed that often the TCP Streams seemed to get shared, so that one of the requests would end up sending an NTLM authentication message (the zero content length) to the proxy after the other had already authenticated. In this situation the proxy just passed through the zero content message (as the stream had already authenticated).
What fixed it for me was moving to a WCF-Custom customBinding (using textMessageEncoding with a messageVersion of Soap11 to maintain my basicHttpBinding behaviour) and (not sure if required) setting keepAliveEnabled to false.
Unfortunately I doubt this is much help for your particular situation, but more info never hurts.