cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming synchronous web service with no input request method

nilocraig
Explorer
0 Kudos

Hi everyone,

First of all, I am new to this (both posting to SCN and web services) so please forgive me if I do something wrong.

I am an ABAP programmer developing a new routine to consume web-services from a 3rd party and have gotten pretty far with the help of wikis and questions and answers on SCN.

I have created the proxy classes from the WDSL, the logical ports and was able to test the methods with success both using the "Test Service Consumer" routine and in my program so everything is working OK.

I am having some trouble with a specific method in my class that has no input parameters. This method is called to list all the products available by our 3rd party vendor, so no input is actually needed.

When I call this webservice from the "Test Service Consumer" routine everything works fine, the request is filled with:

<n0:listarProdutosEnvio xmlns:n0="http://www.agrotis.com.br/ReceitaAgrowin/xsd/" />

But when I call the webservice from my program, the webservice returns nothing, because it is never called. I debugged the code and this happens because no input parameters are set.

I was reading some threads here (http://scn.sap.com/thread/1048467 and http://scn.sap.com/thread/698399) and someone confirmed my suspicions and suggested adding a dummy field to workaround this limitation.

I am a bit confused as to how this could be done. I tried changing my WDSL to add a boolean parameter, regenerated the proxy and sent a false value to the input request. This time it called the webservice but it faults with the message:

SOAP Fault Exception caught: : org.xml.sax.SAXException: cvc-complex-type.2.1: Element 'n0:listarProdutosEnvio' must have no character or element information item [children], because the type's content type is empty


Can anyone shed some light on this?

Thanks for your help!

Nilo Craig

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

You have to add some dummy request parameter like if you send constant PRODUCT means it should retrun all products details.

Very small change in your abap program and request parameter you can give anything but you have to pass constant value.

nilocraig
Explorer
0 Kudos

Hi Raja,

Thanks for your quick reply.

The problem is I cannot change the webservice since it is a 3rd party URL.

Is there anyway into "fooling" abap into thinking there is an input parameter so it would call the webservice but not send anything in the request?

iaki_vila
Active Contributor
0 Kudos

Hi Nilo,

If you generate a dummy tag in different namespace the receiver couldn't deal with it and resolve the problem.

You could generate a message like that:

<n0:listarProdutosEnvio xmlns:n0="http://www.agrotis.com.br/ReceitaAgrowin/xsd/" >

<n1:dummy xmlns:n1="http://dummynaspace"/>

</n0:listarProdutosEnvio xmlns:n0="http://www.agrotis.com.br/ReceitaAgrowin/xsd/" >

Some sytems simply dont deal a tag if this tag is outside of the namespace, may you have luck.

Regards.

Message was edited by: Iñaki Vila

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You are consuming third party service.  So you cannot modify the WSDL. You treat the interface as async and use UDF for webservice. Sender is Proxy and receiver is proxy. Sender structure has dummy request from abap and in the mapping check that value and use UDF to make webservice call. The webservice response is mapped to the target structure. This is workaround.

former_member184681
Active Contributor
0 Kudos

Hi Nilo,

>>> Is there anyway into "fooling" abap into thinking there is an input parameter so it would call the webservice but not send anything in the request?

Well, at least one . Since you already know the place in code where standard processing exits because of no input data, you could implement an implicit enhancement to fool the system. But you might also want to wait for others' opinions, since there might be a "nicer" workaround for this that I do not know about.

Regards,

Greg

rajasekhar_reddy14
Active Contributor
0 Kudos

unfortuntely not possible (my opinion) because you need some dummy request from 3rd party.

Answers (1)

Answers (1)

nilocraig
Explorer
0 Kudos

Just an update, I have solved the problem by asking my 3rd party to include a dummy request so that it would work the generated proxy class as per Raja's suggestion.

I am guessing Baskar's answer is the correct one, but since I still don't have all the knowledge for implementing an async webservice with UDF I took the "easy" way out.

Thanks to everyone for trying to help.