cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Adapter: DO not use soap envelope

Former Member
0 Kudos
2,967

Hi Guys

I have a scenario, which calls a webservice from my ABAP Proxies, the twist in this is that SOAP request expects license info into the header of SOAP envelope, I could achive this by XSLT mapping in the receiver SOAP adapter I selected the option "Do not use SOAP envelope" and could do the call.

Due to this the response received from the webservice is treated as payload, as shown below...

response message payload:


<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Header xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <SubscriptionInfo xmlns="http://ws.strikeiron.com">
      <LicenseStatusCode>0</LicenseStatusCode>
      <LicenseStatus>Valid license key</LicenseStatus>
      <LicenseActionCode>0</LicenseActionCode>
      <LicenseAction>Decremented hit count</LicenseAction>
      <RemainingHits>18</RemainingHits>
      <Amount>0</Amount>
    </SubscriptionInfo>
  </Header>
  <soap:Body>
    <getRateResponse xmlns="CurrencyRates">
      <getRateResult>44.945</getRateResult>
    </getRateResponse>
  </soap:Body>
</soap:Envelope>

and when i am trying to do the response mapping, it is not able to read the value.

Anyone having any idea, on how we could do this.

Thanks

Dheeraj

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Dheeraj,

I am facing a similar problem as you but I am not able to create an XSD for my structure inspite of using various tools. Can you help me on this.the strucure I need is :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">

<soapenv:Body>

<queryResponse>

<result>

<done>true</done>

<queryLocator xsi:nil="true"/>

<records xsi:type="sf:Account">

<sf:Id>001P0000003QmPrIAK</sf:Id>

<sf:BillingCity>Something</sf:BillingCity>

</records>

<size>1</size>

</result>

</queryResponse>

</soapenv:Body>

</soapenv:Envelope>

Any help would be appreciated . Thanks

Regards,

Vinithra

bhavesh_kantilal
Active Contributor
0 Kudos

Dheeraj,

Can you please put forward this solution yoiu developed using the XSLT mapping?

If possible can u send me any documentation you have on this to bhavesh.kantilal@wipro.com.

Regards,

Bhavesh

former_member206604
Active Contributor
0 Kudos

Hi Dheeraj,

I could think of two ways but not very sure try it and let me know

1. Instead of doing a XSLT mapping and selecting "Do not use SOAP envelope", try Adapter module. Handle license section there.

2. Try the same XSLT technique during the response... (This is surely doubtful but just a thought)

Thanks,

Prakash

bhavesh_kantilal
Active Contributor
0 Kudos

Prakash,

Is it possible to access the SOAP header and envelope in the the Adapter Module data? I dont think it is possible. Correct me if I am wrong .

Regards,

Bhavesh

former_member206604
Active Contributor
0 Kudos

Hi,

When you select "Do not use SOAP envelope" both request and response will be treated as payload (as Dheeraj said).

In the Adapter module you can add/remove the SOAP envelope.

Thanks,

Prakash

bhavesh_kantilal
Active Contributor
0 Kudos

Prakash,

Can you just give me the psuedocode to acces the SOAP header in the Adapter Module.?

Regards,

Bhavesh

former_member206604
Active Contributor
0 Kudos

Hi Dheeraj & Bhavesh,

1.In the receiver SOAP adapter under conversion select "<b>Do not use SOAP envelope</b>". (This will ensure no SOAP Envelope is added, meaning its just a payload)

2.(a)Add the adapter module to process the request message (The module that you are specifying here adds the SOAP Envelope). Add the module before the module: sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean

<b>OR</b>

(b)As Dheeraj did use a XSLT mapping to add the SOAP Envelope with the additions(License details) In this case there is no need for a adapter module during request message. (This is preffered)

3.Add the adapter module to process the reponse message (The module that you are specifying here removes the SOAP Envelope as we had set "Do not use SOAP envelop" the whole message including SOAP envelope will be in the payload). Add the module after the module: sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean

Adapter module prorgamming (You all know this already)

/people/alessandro.guarneri/blog/2006/03/16/xi-mapping-module-for-afw

Dheeraj try this and let us know... I never done this before.

Thanks,

Prakash

former_member206604
Active Contributor
0 Kudos

Hi Dheeraj,

One more way just striked my mind, correct me if am worng.

Try defining your response strucutre in this fashion


Envelope
  Header
   SubscriptionInfo
     LicenseStatusCode
     LicenseStatus
     .
     .
  Body
   getRateResponse
     getRateResult

So your response payload will fit into this structure and you can access the values during the response mapping. I don't know if this will work, but if this dose we can avoide adapter module and will be a simple solution.

Try and let me know... What do you say Bhavesh?

Thanks,

Prakash

bhavesh_kantilal
Active Contributor
0 Kudos

Prakash,

Problem in this case is Datatype definition does not allow for a <b>colon :</b> and we need SOAP:ENVELOPE and so on..!!

Regards,

Bhavesh

former_member206604
Active Contributor
0 Kudos

Bhavesh,

But <b>colon:</b> is just the name space it is not the element name. Envelope, Header, Body are the element names. I don't think this should be the problem..

For instance in the maeesge we also do have <b>ns0:</b>

Thanks,

Prakash

bhavesh_kantilal
Active Contributor
0 Kudos

Prakash,

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

In this case, dont we need an element by name soap:ENVELOPE and isn't the name space actually, <i>xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"</i>

Regards,

Bhavesh

udo_martens
Active Contributor
0 Kudos

Hi Bhavesh,

if u use a XSLT, just put a dummy to the datatype. The IF definition will be ignored during runtime.

Regards,

Udo

Former Member
0 Kudos

Hi

I am sorry for replying in so late, was busy with some projects.

I got few mails and this post is cathing up again, so thought of giving the solution I followed without any adapter module or anything, simple plain XSLT mapping.

<u><b>Integration Repository</b></u>

1. Created data type and message type for Outbound Interface

2. Imported the WSDL

3. Created an XSD out of the sample response I got by calling the WSDL (this you can do from any tool available, i used the strikeiron website), pls refer below to see the XSD below, and you will have to use the message type envelope from it.

4. Most Important step, created 2 XSLT mappings, one for request and the other for response., Pls refer below for both these mappings.

5. did the interface mapping

<u><b>Integration Directory</b></u>

1. pls configure your scenario as normaly you do, and while you configure the communication channel for your soap receiver, make sure you click on the do not use soap envelop option.

thats it done.

<u><b>XSLT Request Mapping</b></u>


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
			<SOAP-ENV:Header>
				<LicenseInfo xmlns="http://ws.strikeiron.com">
					<RegisteredUser>
						<UserID>xyz</UserID>
						<Password>xyz</Password>
					</RegisteredUser>
				</LicenseInfo>
			</SOAP-ENV:Header>
			<SOAP-ENV:Body>
				<getConversion xmlns="CurrencyRates">
					<FromCurrencyCode>
						<xsl:value-of select="//fromCurrency"/>
					</FromCurrencyCode>
					<ToCurrencyCode>
						<xsl:value-of select="//ToCurrency"/>
					</ToCurrencyCode>
					<Amount>1</Amount>
				</getConversion>
			</SOAP-ENV:Body>
		</SOAP-ENV:Envelope>
	</xsl:template>
</xsl:stylesheet>

<u><b>XSLT Response Mapping</b></u>


<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="CurrencyRates" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<xsl:template match="/">
		<ns0:MT_Cur_res xmlns:ns0="http://www.april.in/WebService/SOAPHeader">
			<Rate>
				<xsl:value-of select="soap:Envelope/soap:Body/a:getConversionResponse/a:getConversionResult"/>
			</Rate>
		</ns0:MT_Cur_res>
	</xsl:template>
</xsl:stylesheet>

<u><b>Webservice Response XSD</b></u>


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.strikeiron.com" xmlns:ns2="CurrencyRates">
  <xs:import namespace="CurrencyRates" schemaLocation="ns2.xsd"/>
  <xs:import namespace="http://ws.strikeiron.com" schemaLocation="ns1.xsd"/>
  <xs:element name="Envelope">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="soap:Header"/>
        <xs:element ref="soap:Body"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Header">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ns1:SubscriptionInfo"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Body">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ns2:getConversionResponse"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

let me know in case somebody gets stuck somewhere for this scenario.

Take Care

Dheeraj

henrique_pinto
Active Contributor
0 Kudos

> Prakash,

> <soap:Envelope

> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

>

>

> In this case, dont we need an element by name

> soap:ENVELOPE and isn't the name space actually,

> <i>xmlns:soap="http://schemas.xmlsoap.org/soap/envelo

> pe/"</i>

>

> Regards,

> Bhavesh

not at all, "soap" is just the prefix.

I actually don't know if webservice tools are prepared to expect prefix free soap envelopes, but if they are, you could use

<ns1:Envelope xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">

without any problems.

Anyway, if you do need prefix-specific message, you can use Anonymizer Module Processor.

Or, forget everything above and just use XSLT mapping.

It's way easier (though much less performing, but I'm considering this is not a concern now).

Regards,

Henrique.

Former Member
0 Kudos

Hi Henrique

you mentioned

> It's way easier (<b>though much less performing</b>

not sure how? could you please explain your view on this, how could this approach be less performing, so that we could put some thought on this.

Regards

Dheeraj

henrique_pinto
Active Contributor
0 Kudos

It's just a guess, but considering that mapping engine runs on Java stack (not considering abap mapping), java mapping is probably the most performing of the three, while XSLT is probably the least (since mapping engine will need to run xslt processor and then execute the xslt mapping).

Regards,

Henrique.

Former Member
0 Kudos

Can somebody give example of

1) XSLT mapping which can be used to access SOAP Header elements.

2) How use this to determine the receiver.

My scenario is to access the HEADER element in the incoming SOAP Header and use it as a condition for Receiver determination.

Former Member
0 Kudos

Vamsi,

Do u have the solution?

Former Member
0 Kudos

Hi,

For your case, it would be much easier to instead use the axis adapter and read the relevant header fields into the dynamic configuration header. Have you considered this approach? The axis adapter FAQ Note 1039369 has several examples illustrating how to read arbitrary header values.

Regards, Yza

Former Member
0 Kudos

Hi Dheeraj!

I also have the problem that I have to create the SOAP envelope by myself (special tags the receiving application expects to find in the SOAP header) but I have no idea how this could work. You said something about XSL, Could you tell me how you did it and eventually even send me a sample?

THIS WOULD BE VERY GREAT!!!

Thanx in advance!

Regards,

Volker

email: vk@bfact.com