$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
1

Exception invoking SOAP Web Service using SAP HCI

Feb 08, 2017 at 10:13 AM

1.1k

avatar image
Former Member

Hi,

I am trying to consume webservice usinh HCI.

Below is my flow:

poc1.png

Following is the webservice I am invoking:

http://www.webservicex.net/currencyconvertor.asmx

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
    <Body>
        <ConversionRate xmlns="http://www.webserviceX.NET/">
            <FromCurrency>INR</FromCurrency>
            <ToCurrency>GBP</ToCurrency>
        </ConversionRate>
    </Body>
</Envelope>

Following is the snapshot of my Receiver channel:

poc2.png

Below is the groovy script attached with the Script step which sets the payload:

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.xml.MarkupBuilder;


def Message processData(Message message) {
	
	def xmlWriter = new StringWriter() 
	def xmlMarkup = new MarkupBuilder(xmlWriter)  
	
	xmlMarkup
	    .'Envelope'('xmlns':'http://www.w3.org/2003/05/soap-envelope') {          
	                'Body'{
	                    'ConversionRate' ('xmlns':'http://www.webserviceX.NET/'){
	                        'FromCurrency'('GBP')
	                        'ToCurrency'('INR')
	                     }
	                }
	    }
	
	println "Printing xml data##" + xmlWriter.toString()


	//Body 
	def body = message.getBody();
	message.setBody(xmlWriter.toString());
	
	println "Printing header data" + message.getHeaders()
	
	message.setHeader("CamelHttpMethod", "POST");
	
	message.setHeader("SOAPAction", "http://www.webserviceX.NET/ConversionRate");
	message.setHeader("Content-Type", "application/soap+xml");
	message.setHeader("operationName", "ConversionRate");
	message.setHeader("operationNamespace", "http://www.webserviceX.NET/");
	
	println "MMDRePrinting header data###" + message.getHeaders()
	
	return message;
}

After I deploy the flow I keep getting the following error:

java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.
	at org.apache.camel.component.cxf.CxfEndpoint$CamelCxfClientImpl.setParameters(CxfEndpoint.java:1177)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:470)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)


FOllowing is the log of messagepayload and its header

2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#Printing xml data\#\#<Envelope xmlns='http://www.w3.org/2003/05/soap-envelope'>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#  <Body>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#    <ConversionRate xmlns='http://www.webserviceX.NET/'>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#      <FromCurrency>GBP</FromCurrency>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#      <ToCurrency>INR</ToCurrency>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#    </ConversionRate>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#  </Body>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#</Envelope>|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#Printing header data[CamelHttpMethod:GET, CamelHttpPath:, CamelHttpQuery:null, CamelHttpUrl:https://l4039-iflmap.hcisbp.eu1.hana.ondemand.com/http/neebalpoc, CamelServletContextPath:/neebalpoc, SAP_MessageProcessingLogID:AFia6PMiaRk-SmztbWDFqX_MCGk4, scriptFile:currencyConversion.groovy, scriptFileType:groovy]|
2017 02 08 09:46:27#+00#INFO#System.out##S0003263313#http-bio-8041-exec-5#na#avrhcip#l4039iflmap#web#acd2cb4b0#MMDRePrinting header data\#\#\#[CamelHttpMethod:POST, CamelHttpPath:, CamelHttpQuery:null, CamelHttpUrl:https://l4039-iflmap.hcisbp.eu1.hana.ondemand.com/http/neebalpoc, CamelServletContextPath:/neebalpoc, Content-Type:application/soap+xml, operationName:ConversionRate, operationNamespace:http://www.webserviceX.NET/, SAP_MessageProcessingLogID:AFia6PMiaRk-SmztbWDFqX_MCGk4, scriptFile:currencyConversion.groovy, scriptFileType:groovy, SOAPAction:http://www.webserviceX.NET/ConversionRate]|
<br>


An internal server error occured: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage..

Please help me here. What is it that I am doing wrong over here?

poc1.png (25.2 kB)
poc2.png (24.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Sriprasad Shivaram Bhat Feb 09, 2017 at 12:53 PM
1

Hello Raj,

You can use the Request Reply which sends the request to SOAP Server from SAP HCI and receives the response back to SAP HCI.

Below might give more insight( Instead of HTTP adapter i have used timer Event )

Regards,

Sriprasad Shivaram Bhat


Share
10 |10000 characters needed characters left characters exceeded
Sriprasad Shivaram Bhat Feb 08, 2017 at 06:50 PM
0

Hello Raj,

Issue is with your XML input to web service.Use below modified script it should work for you.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.xml.MarkupBuilder;


def Message processData(Message message) {
    
    def xmlWriter = new StringWriter() 
    def xmlMarkup = new MarkupBuilder(xmlWriter)  
    

    //Build Input XML
    xmlMarkup.'ns2:ConversionRate' ("xmlns:ns2":"http://www.webserviceX.NET/"){
                            'ns2:FromCurrency'('GBP')
                            'ns2:ToCurrency'('INR')
                         }  
    //println "Printing xml data##" + xmlWriter.toString()

    //Body 
    def body = message.getBody();
    message.setBody(xmlWriter.toString());    
    
   //Set Headers
    message.setHeader("CamelHttpMethod", "POST");    
    message.setHeader("SOAPAction", "http://www.webserviceX.NET/ConversionRate");
    message.setHeader("Content-Type", "application/soap+xml");
    message.setHeader("operationName", "ConversionRate");
    message.setHeader("operationNamespace", "http://www.webserviceX.NET/");
       
    return message;
}

And in the channel set the authentication to None or check Connect without client authentication.

Regards,

Sriprasad Shivaram Bhat

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Sriprasad,

I have a similar case where I'm sending a CDATA xml to Kenexa as a Soap Input. How can I prepare the inputXML in this case?

Thanks

Sathish

0
avatar image
Former Member Feb 09, 2017 at 09:10 AM
0

Dear Sriprasad,

Thanks for your prompt response.

I tried the above change. Putting the trace below of the execution.

2017 02 09 09:04:58#+00#INFO#System.out##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#Entering process data\#\#\#|
2017 02 09 09:04:58#+00#INFO#System.out##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#Printing xml data\#\#<ns2:ConversionRate xmlns:ns2='http://www.webserviceX.NET/'>|
2017 02 09 09:04:58#+00#INFO#System.out##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#  <ns2:FromCurrency>GBP</ns2:FromCurrency>|
2017 02 09 09:04:58#+00#INFO#System.out##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#  <ns2:ToCurrency>INR</ns2:ToCurrency>|
2017 02 09 09:04:58#+00#INFO#System.out##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#</ns2:ConversionRate>|
2017 02 09 09:04:58#+00#ERROR#org.apache.camel.processor.DefaultErrorHandler##S0003263313#http-bio-8041-exec-7#na#avrhcip#l4039iflmap#web#acd2cb4b0#Failed delivery for (MessageId: ID-vsa2087437-od-sap-biz-48247-1486482804609-195-3 on ExchangeId: ID-vsa2087437-od-sap-biz-48247-1486482804609-195-2). Exhausted after delivery attempt: 1 caught: java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.


Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
[Process_1         ] [Process_1         ] [sap-http:/neebalpoc                                                           ] [       116]
[Process_1         ] [to292             ] [sap-pp-util://sender                                                          ] [         3]
[Process_1         ] [removeHeaders152  ] [removeHeaders[*]                                                              ] [         3]
[Process_1         ] [CallActivity_2_148] [setHeader[scriptFile]                                                         ] [         2]
[Process_1         ] [setHeader182      ] [setHeader[scriptFileType]                                                     ] [         2]
[Process_1         ] [bean68            ] [bean[ref:scriptprocessor method: process]                                     ] [        78]
[Process_1         ] [removeHeader200   ] [removeHeader[operationName]                                                   ] [        14]
[Process_1         ] [removeHeader201   ] [removeHeader[operationNamespace]                                              ] [         2]
[Process_1         ] [MessageFlow_2_1486] [cxf:bean:Receiver1_                                                           ] [        11]


Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.
	at org.apache.camel.component.cxf.CxfEndpoint$CamelCxfClientImpl.setParameters(CxfEndpoint.java:1177)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:470)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
	at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:157)
	at org.apache.camel.impl.SynchronousDelegateProducer.process(SynchronousDelegateProducer.java:62)
	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
	at com.sap.it.op.agent.collector.camel.MplInterceptor$MplAsyncProcessor.process(MplInterceptor.java:195)
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:463)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)

But I still get the same error. Also, I notice that you are now inserting only the core message. The message is not surrounded by SOAP envelope and its body. Should HCI do it on its own?

I had enabled tracing. Please find below the payload contents:

How can I get this working. Is there any other information you can help me with?

Regards,


payload.png (54.6 kB)
header.png (65.3 kB)
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 09, 2017 at 01:59 PM
0

Dear Sriprasad,

I was just about to message you that I was able to get it working with Request-Reply mechanism approach :)

But your reply definitely helped :)

But it sounds strange that why the same flow failed when call to target system was not through Request-reply mechanism. Any insights on that?

Thanks a lot again.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 29, 2017 at 10:23 AM
0

//Build InputXML -

I get the input xml data after series of steps content enricher/modifier and then pass it to request reply and make a soap call to kenexa. Using the script above how to build this input xml as I cannot declare the payload individually.

Share
10 |10000 characters needed characters left characters exceeded