Forum Discussion

neerajupadhyay's avatar
11 years ago

WCF with CustomBinding

Hi,

Need help in sending a request which is for WCF service. The service has Custom Binding ( The request is Binary encoded).

Initially i was getting the HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml;charset=UTF-8;action="Phase"' was not the expected type 'application/soap+msbin1'.

So I manually added a header Content-Type = 'application/soap+msbin1'. Now the previous error was gone. I also added Outgoing WS-security config but now I am getting the following error

HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
X-AspNet-Version: 4.0.30319
Set-Cookie: ASP.NET_SessionId=cf51bjyq0i1blrv5upbojkuu; path=/; HttpOnly
X-Powered-By: ASP.NET
Date: Tue, 13 Jan 2015 17:40:12 GMT

Bad Request

Let me know if any more details are needed. I have detailed the log below and attached WS Security Config details

---------------------------------------------------------------------------------------------------------------------------------------------------------------
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "POST /xxxxxxxx/xxxxxApi.svc HTTP/1.1[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "Content-Type: application/soap+msbin1[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "Content-Length: 4136[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "Host: xxxxxxx.xxxx.xxxx.net[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">[\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> " <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsse:Security 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"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-

open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"

wsu:Id="E82F1421AFD81DDFDC142117081258641">MIIDaTCCAtagAwIBAgIQwyjarZ/HD4BIjTMZ

+CzQgDAJBgUrDgMCHQUAMIGLMSswKQYDVQQLEyJDcmVhdGVkIGJ5IGh0dHA6Ly93d3cuZmlkZGxlcjIuY29tMSEwHwYDVQQKHhgARABPAF8ATgBPAFQAXwBUAFIAVQBTAFQxOTA3BgNVBAMeMABEAE8AXwBOAE8AVABfAFQAUgBVAFMAVABfAEYAaQBkAGQAbABlA

HIAUgBvAG8AdDAeFw0xMzEyMTEwMDAwMDBaFw0yNDEyMTAyMzU5NTlaMHYxKzApBgNVBAsTIkNyZWF0ZWQgYnkgaHR0cDovL3d3dy5maWRkbGVyMi5jb20xITAfBgNVBAoeGABEAE8AXwBOAE8AVABfAFQAUgBVAFMAVDEkMCIGA1UEAxMbYnJzcGdxYWRldjIuZW

1lYS5jc2hhcmUubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDugbGkJ4seUwk2y+kKQ1r3u1ly4Q

+57wqKODo6TL4QbCoQI/vxlWU3jmJvEXd4BHzLMIUOoHeLQzn4gcEYsw1RuKuVp9T1Yi8kFnOyeGxM9MpH1/k2sfh2l51i8EEfO2EHKoupmNVBT/vZ/xS9zueS8X2xno3yBa

+RrAhnXZReHQIDAQABo4HpMIHmMAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwgcAGA1UdAQSBuDCBtYAQ4PSweGe3ahCxVYg0+FckHaGBjjCBizErMCkGA1UECxMiQ3JlYXRlZCBieSBodHRwOi8vd3d3LmZpZGRsZXIyLmNvbTEhMB8GA1UECh4

YAEQATwBfAE4ATwBUAF8AVABSAFUAUwBUMTkwNwYDVQQDHjAARABPAF8ATgBPAFQAXwBUAFIAVQBTAFQAXwBGAGkAZABkAGwAZQByAFIAbwBvAHSCEDcDoi

+BfYCETb77VCQYqIIwCQYFKw4DAh0FAAOBgQBfccH7K6ZkVNVMfl/WzMqyTsp0Q0CyiozWuSPzREJ/dUx1SDLHQXTfX7VK6szDGQIHE+L4di0IdRP31S+GwDJjE0guEUf/6Mz2XMgPKAfgEX7aSEtwSkOKBnDx8oW7BURR5VdPmBCcrCE

+4RR6Bj5XiHoSdFKsIXLblsQHCpUpYw==</wsse:BinarySecurityToken><xenc:EncryptedKey Id="EK-E82F1421AFD81DDFDC142117081258640" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:EncryptionMethod

Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><wsse:SecurityTokenReference><wsse:Reference URI="#E82F1421AFD81DDFDC142117081258641"

ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-

1.0#X509v3"/></wsse:SecurityTokenReference></ds:KeyInfo><xenc:CipherData><xenc:CipherValue>4Q2aV4xwHVaVD8X6a/dcSz9cxUXMRFl3WWJW32dtieabqQps/cKaFvJN/WLmVcYgzczEqhdlHZSUBFcVt7yQe2HV1WD6hPw7lm5QxHqSka

aoVv0kUw7zHX3WyTp8yxNUhmE2D0Rxd8RkjCXbvRtgfSFBce1Il0UY2FoO5FiB/U8=</xenc:CipherValue></xenc:CipherData><xenc:ReferenceList><xenc:DataReference URI="#ED-

E82F1421AFD81DDFDC142117081258642"/></xenc:ReferenceList></xenc:EncryptedKey></wsse:Security><wsa:Action>DeleteAuditPhase</wsa:Action></soap:Header>[\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> " <soap:Body><xenc:EncryptedData Id="ED-E82F1421AFD81DDFDC142117081258642" Type="http://www.w3.org/2001/04/xmlenc#Content"

xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><ds:KeyInfo

xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><wsse:SecurityTokenReference wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey"

xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd"><wsse:Reference

URI="#EK-E82F1421AFD81DDFDC142117081258640"/></wsse:SecurityTokenReference></ds:KeyInfo><xenc:CipherData><xenc:CipherValue>HA0J7uT7Olao2hfo4QE7KVRoG5Bwu5psNCZOnv+qXrU8VH1iY2q159uafoSCp5euoTHuZO

+fX/ewRrMxur+V0SLLlHp0oI95J79NUNaejVx52PMzP+TE8Cz3OILyoM4BB

+yRUZHPSSb1u6bqNRNM4TODkTKrQs0QHmKKvV8ISlTRLpcSWEToUD62Q2CZwCBdiTGdRC85neCoQDRPRDOXdW84VRqeIi5D03uR8LUfGjr65iHgsUUT1IejDeqv8igDqMO4eiU6X0tixp1i2sfpsMP/turquUoDV9IqcyC6l7OkBNQvFe9XlO5Rm1XkGKK12YrWdO

v4mddJT+Pc6ai9Os78Yc0xNtSbfC1jzXRSitIvrKm/P6FTuH6M0sYuaZK/XNMy5QWussqIG/tyk/GPKu6PuprEHQfcceb9XPOTbWxhuPzm0zNzzuf9++lDK1NFGm9p3APmi1BhKecdaO/P+QMOmlpv9Ah1Z7t4mRg69aI0K4ejH2RNCL2qOyEAELh4wG1eKV150N

+UOdftYJCIBA==</xenc:CipherValue></xenc:CipherData></xenc:EncryptedData></soap:Body>[\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:>> "</soap:Envelope>"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "HTTP/1.1 400 Bad Request[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Cache-Control: private[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Transfer-Encoding: chunked[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Content-Type: text/html[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "X-AspNet-Version: 4.0.30319[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Set-Cookie: ASP.NET_SessionId=cf51bjyq0i1blrv5upbojkuu; path=/; HttpOnly[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "X-Powered-By: ASP.NET[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Date: Tue, 13 Jan 2015 17:40:12 GMT[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "b[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "Bad Request"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "0[\r][\n]"
Tue Jan 13 17:40:12 GMT 2015:DEBUG:<< "[\r][\n]"
No RepliesBe the first to reply