简体   繁体   中英

Content-Type application/soap+msbin1 in SOAP UI / SOAP UI PRO

I have a WCF service and I am attempting to use it with SOAP UI PRO. On the first execution I got the following response:

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

I found out that I should have added the Content-Type header and I did so (ie Content-Type application/soap+msbin1 ). However, the error now evolved to:

HTTP/1.1 400 Bad Request

I learned that Binary-Encoding is not supported in SOAP UI / SOAP UI PRO / READY API, and I'm kinda of stuck after this discovery.

I was wondering whether there is a workaround to this issue. Hence, whether someone managed to use groovy script, plugins, libraries or something different to integrate binary-encoding in SOAP UI PRO.

Any help is greatly appreciated.

The application/soap+msbin1 is a binary encoding of WCF. You are sending requests with text encoding. That is why the server side gives: Bad request .

As far as I know, SoapUI does not support the application/soap+msbin1 encoding and there is no plugin available.

If you need to test the service with SoapUI you have 2 options:

  1. Change the service (server-side) binding to text encoding (by configuration in web.config ). Please note that a service can have multiple bindings, co you can test a binding with text encoding, whereas WCF clients can use binary (application/soap+msbin1) encoding. Text encoding is anyway needed to achieve interoperability with non-WCF clients (such as SoapUI). You can check Microsoft documentation for more.

  2. Encode your soap request into binary data and send it as a HTTP PUT request. Of course you would also need to decode the service response to understand it. This might be a way for a one-time test, otherwise it's too cumbersome. You could do the binary encoding/decoding on-the-fly with Groovy scripting, in case you need to do many tests, but there's some programming needed.

I definitely recommend the first option.

Karel

What worked for me

Create a Custom Binding and make sure you use

**<binaryMessageEncoding />**

<bindings>
  <customBinding>
    <binding name="MyCustomBinding">
       <binaryMessageEncoding />
    </binding>

and refer to it in your endpoint.

 <endpoint address="https://..." binding="customBinding" bindingConfiguration="MyCustomBinding" contract="..." name="..." />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM