Extract header and body from api


Can you help me understand how to extract the header and body from an API response? In this case, we need to handle the situation when consuming a SOAP API where the response is not static. I am unable to check the error code because I don’t know the specific error codes, nor do I know what results should be returned from the third-party or provider. I need to retrieve the message body and message header using a method. Please note that the API document in the pipeline does not appear, only the document name is visible, and the variables in the document are hidden.

If you are using pub.client:soapClient manually to consume a SOAP end point, the response and the header is already set in the output, but they are not defined; you can use them but you need to map them to correct document type. All you need to do is to map the field to the correct data type. I am not entirely sure about what you mean by not static response. SOAP messages are usually well defined, you can even find the xsd of the xml in the WSDL. If you are importing a WSDL, you will have wrapper services defined automatically. This automatically defined services will also use pub.client:soapClient but they will have their output mapped correctly.

pub.client:soapClient service doesn’t know the response type/structure of the SOAP service, therefore it maps the output as empty document, but it doesn’t mean the document is empty. When you map this empty looking document to the proper document you will have every value mapped as it is supposed to hence you can use whatever you need just by mapping. When you import a WSDL IntegrationServer parses the XSD in the WSDL and maps the output document to pub.client:soapClient output.

If you don’t know what you will receive from a SOAP service, I recommend checking the WSDL of the API. SOAP resposne must be defined in the descriptor.

If you need anything more complicated then just calling SOAP services or importing a WSDL, you can use services below pub.soap in WmPublic package. For more information I recommend checking the documentation below.

currently I am not using it , but I will try to use it, but I want to ask you question in the response from soap API contains the tag or special character like @xmlns in the header how we can remove it? kindly note this tag or special character cannot appear in document just in response.

thank you .

Hi Mohammad,

when SOAP Response uses namespacing, this should handled when mapping the DocType to the imported DocType Structure.
By doing so the SOAP handler identifies the fields of each namespace and assigns the proper prefix to the field names.

If possible please provide a sampe SOAP Request and SOAP Resposnse for further analysis and assistance.


They are usually part of the XML, I don’t think you are supposed to remove them but if you really DO want to drop them I suppose you can drop them from pipeline like any other pipeline object. Anything you see starting with @ indicates they are attributes. Attributes are different from elements but they can have a similar use cases. Can you tell me what you are trying to accomplish by removing them?

Keep in mind that anything you see in the XML shema definition(XSD) will exist in the document as map-able element but this doesn’t mean there is a data in that field; and anything you see in the XML will exists as data hence can be mapped as well but it can be invisible if it doesn’t exist in the schema. If the data in the attributes are not breaking anything and is not confidential you can leave it there.

1 Like

By any chance are you experiencing mapping problems because the field that you are mapping is complex type rather then a simple type that you can map directly? This usually happens when you have attributes in your XML but the solution is NOT to remove those attributes. If your element has an attribute, then this element is a complex type document. The difference in between is, if your document definition has these attributes defined in it than your data will be below your element name and named as data. You need to map this data to the field that you are mapping, not the complex type. If there is no attributes in the document then your object will be simple type (will have no child attributes or elements) hence can be mapped directly. Please provide some screenshots if this is the case. If your output document also has these attributes then only then you can map the complex type to a complex type. If you map a complex type to a simple type, it will not generate an error; instead it will create a new complex type with the same name as the simple type and create the rest of the data in the new complex type and the simple type you mapped will be empty.


when fields are defined in the schema to have attributes, these attributes will appear as fields in the document type structure with a special prefix indicating that it is not a regular field/tag in the XML, but an attribute to that field/tag.
Usually the prefix is defined as “@”, but this can be configured somewhere.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.