· Sep 23, 2021

Unexpected ContenType when call a WS Soap

Hi community,

I have a SOAP Client class that connect to a WS Service. This structure and configuration is the same for some providers that are integrated with my solution.

If I call to a provider, it returns the XML expected. But there is a provider that raises an error:

ERROR #6243: HTTP request to SOAP WebService returned response with unexpected CONTENT-TYPE: application/wsdl+xml

I've tried to set the ContentType to the adapter.%Client with this value, but it doesn't work.

If I call them using SOAP UI, with the same Soap Envelop, it works fine, and the Content-Type is text/xml

Can anyone help me?

Best regards,
Kurro Lopez

Product version: Ensemble 2017.1
$ZV: Cache for Windows (x86-64) 2017.2.1 (Build 801_3U) Thu Apr 12 2018 10:02:23 EDT
Discussion (3)3
Log in or sign up to continue

Hi Kurro,

Some random suggestions without being able to see the implementation details...

1. Enable the SOAP log and compare the request and response headers to SOAP UI to see what is different

2. Does changing the SOAP version make any difference

3. The error is probably raised in this block of code, might be worth working backwards from there, its at the end of DoSOAPRequest in %SOAP.WebClient

    Set responseContentType=$zcvt($piece(response.ContentType,";",1),"L")
    If ..SoapBinary {
        If (responseContentType'="application/octet-stream") Quit $$$ERROR($$$SOAPUnexpectedType,response.ContentType)
    } Else {
        If (responseContentType'="text/xml") && 
           (responseContentType'="application/soap+xml") &&
           (responseContentType'="multipart/related") {
            Quit $$$ERROR($$$SOAPUnexpectedType,response.ContentType)

4. If your running out of ideas then maybe reinstall / restart the server code (is it .NET by any chance)?

Hi Sean,

I've created my Business Operation using the wizard to create SOAP Client.

I've modified the object to change the location and namespace according to the provider. This value is into the message.

This is a pice of the code:

Method MyMethod(pRequest As MyMessageWS.RequestsearchInfoRequest, Output pResponse As MyMessageWS.RequestsearchInfoResponse) As %Library.Status
    do ..prepareOperation(pRequest)
    Set tSC = ..Adapter.InvokeMethod("searchInfo",.info,pRequest.idSpeciality,pRequest.listaActs,pRequest.healthCenter,pRequest.aditionalInfo)
    Quit:$$$ISERR(tSC) tSC
    Set tSC = pRequest.NewResponse(.pResponse)  Quit:$$$ISERR(tSC) tSC
    Set pResponse.InfoCentro=$get(info)
    Quit $$$OK

Method prepareOperation(pRequest As MyMessageWS.Request.base) As %Status
 Set ..Adapter.%Client.Namespace = pRequest.Namespace
 Set ..Adapter.%Client.Location = pRequest.Url
 Quit $$$OK

The problem is the InvokeMethod is raising the error, so I'm not able to modify this code. It's part of the %Soap library.

If you are not re-generating the operation code then I wouldn't be worried to change it if required.

The implementation class will be on the adapter..

Property %Client As %SOAP.WebClient;

So if for instance you change the SOAP version (should that make a difference) then it could be done with

set ..Adapter.%Client.SoapVersion="1.2"

First though, I would enable the SOAP log and compare the headers to your working SOAP UI headers.