cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Proxy to HTTP Synchronous

Former Member
0 Kudos

Hi All,

My scenario is ABAP Proxy to HTTP POST synchronous, while I am trying to execute the scenario I get the following error in SXMB_MONI:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Call Adapter

-->

- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER</SAP:Code>

<SAP:P1>404</SAP:P1>

<SAP:P2>Not Found</SAP:P2>

<SAP:P3><Exception><Status>The resource you requested does not exist</Status><Reason>Event does not exist</Reason><Code>404</Code></Exception></SAP:P3>

<SAP:P4 />

<SAP:AdditionalText />

<SAP:Stack>HTTP server code 404 reason Not Found explanation <Exception><Status>The event resource you requested does not exist</Status><Reason>Event does not exist</Reason><Code>404</Code></Exception></SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

What I understand is the target HTTP server sends a error response because my request xml data is not valid

How do I structure my response message type and how do I map this response to the calling ABAP Proxy. The target HTTP server says if the data is fine they will send a success message in the http header, how do i map this response from http header back to calling ABAP Proxy.

Thx in advance

Ravijeet

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>>SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER</SAP:Code>

<SAP:P1>404</SAP:P1>

<SAP:P2>Not Found</SAP:P2>

<SAP:P3><Exception><Status>The resource you requested does not exist</Status><Reason>Event does not exist</Reason><Code>404</Code></Exception></SAP:P3>

The post URL attributes or query string is not accepted by the remote HTTP Server. Try to post using browser and see what error message do you get?

Hope this helps.

Former Member
0 Kudos

Hi All,

This is a proper response which comes from target http server, I need to pass some valid data in the xml I am posting. So if there is some invalid data in the request xml then the target http server throws this exception and if the data is fine it sends a http response without any payload and the success status is in the http response header.

In the request XML Payload i have an element Event and if that Event is not a valid one then the http server says <Reason>Event does not exist</Reason>

<?xml version="1.0" encoding="UTF-8"?>

<MT_HttpEventLogin_Req>

<Event>USR444</Event>

<InstallDate>2011-11-15T00:00:00-05:00</InstallDate>

<InstallTicketId>636363</InstallTicketId>

</MT_FitLogin_Req>

Here I am unable to determine what would be my response message type.

My other question is how do I map the http response header to the ABAP Proxy. Where do I do the mapping of http response header to my response ABAP Proxy ??

Thanx in advance

Ravijeet

Edited by: RAVIJEET.SAP.PI on Jan 17, 2011 10:08 AM

Edited by: RAVIJEET.SAP.PI on Jan 17, 2011 10:14 AM

former_member200962
Active Contributor
0 Kudos
Here I am unable to determine what would be my response message type.

will you get a new Message structure for every request made to the http server?

My other question is how do I map the http response header to the ABAP Proxy. Where do I do the mapping of http 
response header to my response ABAP Proxy ??

make use of the HeaderFieldOne...HeaderFieldSix of the receiver HTTP channel:

http://help.sap.com/saphelp_nw04/helpdata/en/43/64dbb0af9f30b4e10000000a11466f/content.htm ....logic to be implemented in response mapping program.

Regards,

Abhishek.

Former Member
0 Kudos

Hi Abhishek,

The target http server says that if my xml request data is valid then they will send a response back in the http header in a field call route.

And if the xml request data is not valid then they will throw an exception, which I am getting from the target http server as below in SXMB_MONI :

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Call Adapter -->

- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER</SAP:Code>

<SAP:P1>400</SAP:P1>

<SAP:P2>Bad Request</SAP:P2>

<SAP:P3><Exception><Status>Bad Request</Status><Reason>ActivityId and ActivityStep combination already exists</Reason><Code>400</Code></Exception></SAP:P3>

<SAP:P4 />

<SAP:AdditionalText />

<SAP:Stack>HTTP server code 400 reason Bad Request explanation <Exception><Status>Bad Request</Status><Reason>ActivityId and ActivityStep combination already exists</Reason><Code>400</Code></Exception></SAP:Stack>

<SAP:Retry>N</SAP:Retry>

</SAP:Error>

What I want to know is do I need to create a response message type as below:

<?xml version="1.0" encoding="UTF-8"?>

<Exception>

<Status/>

<Reason/>

<Code/>

</Exception>

Thx in advance

Ravijeet

former_member200962
Active Contributor
0 Kudos

1) if possible try to catch this as a fault message and send it to the sending service.

2) if possible try not to send an invalid data to the receiver application....if the data that you send is not of any use in receiver then better avoid sending it.

 What I want to know is do I need to create a response message type as below:

as mentioned in point 1 it should be treated like a fault message......response message would have other structure....which you would expect when the data is valid.

Regards,

Abhishek.

Former Member
0 Kudos

HI Abhishek,

In my case the users enters the data in the front end portal and that data is sent to SAP PI to post to the HTTP server using HTTP POST. So the data sent by the front end can be any data, this data is validated at the time of posting whether it is valid or not e.g some business rule which decide data is valid or not .

Can I design this scenario as a sysnchronous interface if the target system says that if the xml request is fine we will send a url link in a header field of the http response and no payload in response http body. But if the data is invalid we will send the reason why the data is invalid in the payload in HTTP Body.

Can this scenario be handled by normal HTTP adapter as a synchronous interface bacause in case of success I will have no payload just the HTTP header in the response which I need to map back to the calling ABAP Proxy.

Regards

Ravijeet

Edited by: RAVIJEET.SAP.PI on Jan 18, 2011 9:04 PM

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>> Can this scenario be handled by normal HTTP adapter as a synchronous interface bacause in case of success I will have no payload just the HTTP header in the response which I need to map back to the calling ABAP Proxy.

HTTP Synchronous is possible and look at the following links...

/people/kausik.medavarapu/blog/2005/12/29/csv-file-lookup-with-http-request-and-response-in-xi

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

Hope the above links might be helpful. If not, please contact us.

Former Member
0 Kudos

Hi,

I am able to get the URL in the response message in the http header after successful posting using the HTTP Header field in ASMA and as I was saying the response won't have a http body. So it goes into error when it is going for the response mapping back to the calling ABAP Proxy:

RuntimeException during appliction Java mapping com/sap/xi/tf/_MM_REST_LOGIN_HTTP_to_PROXY_REQ_ Thrown: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Premature end of file. at com.sap.aii.mappingtool.tf7.Transformer.checkParserException(Transformer.java:176)

In case of success I will have no payload just the HTTP header in the response which I need to map back to the calling ABAP Proxy.

Thx in advance

Ravijeet

stefan_grube
Active Contributor
0 Kudos

> Can this scenario be handled by normal HTTP adapter as a synchronous interface bacause in case of success I will have no payload just the HTTP header in the response which I need to map back to the calling ABAP Proxy.

No. You cannot have either a response or not.

I recommend to convince your partners to change the interface on receiver side.

Otherwise you have to go for Java proxy to forward the data to do the HTTP receiver and interpret the rsponse.

This is much effort and requires Java skills, so this should only be done, when no other solution is possible.

Former Member
0 Kudos

Hi Stefan,

Thanks for your reply. No as this is Restful communication they say it is not always required to carry a http body in a valid http response. They say the response will be just an url in the http header field.

I had a few queries if I am using the Java Proxy approach. As I am on PI 7.1 EHP 1 I am creating my Proxy directly in NWDS connecting it to ESR, then doing Generate Java Bean Skeleton . I was able to successfully do this. After creating the Java Proxy do we expose it as Webservice in SOA MANAGEMENT in Single Sign on and use SOAP adapter to call it, thats what I have done ?

Also in the ImplBean class which api's or jars to use for HTTP connection. I have used the HTTPClient.jar present on SAP J2ee libraries on server which supports methods as GET, DELETE, PUT and POST.

Thx in advance

Ravijeet

Edited by: RAVIJEET.SAP.PI on Jan 19, 2011 6:18 PM

stefan_grube
Active Contributor
0 Kudos

> Thanks for your reply. No as this is Restful communication they say it is not always required to carry a http body in a valid http response. They say the response will be just an url in the http header field.

Of course in general an HTTP response can be anything, there is no standard for it.

But PI http adapter cannot handle this.

In an implementation project people should check the capabilities of the connected systems and design interfaces together.

But in real life, this does not happen. People design an interface and the middleware should even repair the data if necessary.

REST is not supported by PI and therefore should not be used. You have to program the REST protocol by your own with many effort. I think it is better to look for alternative solutions, for example SOAP.

Answers (1)

Answers (1)

former_member181985
Active Contributor
0 Kudos

The HTTP URL you are trying to ping either doesnt exist or it is outside your network/Firewall.

Former Member
0 Kudos

Check the receiver hostname in CC, and try to ping it from the xi machine.

Check if the receiver service is avaible.

Former Member
0 Kudos

Hallo@all

the error code 400 doesn´t mean that you don´t have connection from XI to target System over HTTP, but it mean that you have sent a Bad request.

Check the Outgoing message and try again.