cancel
Showing results for 
Search instead for 
Did you mean: 

Testing non-SAP Webservices called from WAS 6.20

Former Member
0 Kudos

Hi,

I'm trying to call an external (created in .NET) webservice via the internet from ABAP within a 6.20 WAS. I have the SAP test program working and I can call my own Z_WebServices via my own R/3 HTTP server so the SOAP processor is working correctly. However I cannot get the call to non SAP WebServices to work. I currently have the error message: "Server did not recognize the value of HTTP Header SOAPAction:"

I suspect this is related to the parameters in:

CALL METHOD osoap->set_method

EXPORTING

  • nsprefix = 'saprfc'

nsvalue = CSoapConstants=>sc_rfc_function_ns

  • attributes =

name = 'HelloWorld'.

Where nsprefix is optional and nsvalue should be the non-SAP values. Has anyone faced this problem? Any ideas?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Eddy,

Thanks for that, it didn't directly answer the question but gave me enough insight into the problem to get the solution! The problem, as indicated in the WebLog, is that .NET webservices require a value for SOAPAction. This is NOT required for RFC-based webservices which is why all my testing (based on RFC webservices) worked correctly. The anwer then is to add a couple of lines of code to populate the SOAPAction in the otrans class.

Hence in the adapted version of the test program (found in SAPHelp http://help.sap.com/saphelp_47x200/helpdata/en/2d/64d023e74911d6b2e400508b6b8a93/frameset.htm) I simply needed to replace the sample webservice values with those of my webservice and then insert the following:

  • SET SOAPACtion

CALL METHOD otransp->set_soapaction

EXPORTING

soapaction = '"http://tempuri.org/HelloWorld"'

NB the value for soapaction can be found in the WSDL of your .NET webservice, you may need to be careful with the quotation marks though!.

Former Member
0 Kudos

Hello Asterix,

I have the same issue and tried to solve it with the solution you gave (i.e : inserting :

"CALL METHOD otransp->set_soapaction

EXPORTING

soapaction = '"http://tempuri.org/HelloWorld"')

But I have an error message : invalid ref.

Do you set those lines before setting the transport and payload ??

Can u provide a bigger slice of your code ? thanks a lot

Message was edited by: laurent dhellin

Former Member
0 Kudos

Hi Laurent,

A couple of things: the value of the SOAPAction should be contained in the WSDL of the WebService you are calling. in my example the WSDL contained the line:

<soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />

So there is probably something similar in yours, which may be the same if yours also happens to be called HelloWorld but should be different if it is called anything else.

Secondly, I set the value - as you guessed, after setting the payload (see snippet below). Also note that you need to have the correct path settings in your HTTP Server, as maintained in /nSM59. In my case this was shown in the WSDL in the entry '<soap:address location=....' I split the value of Location so that the IP address part was the "Target Host" in SM59 and the rest was 'PathPrefix'. Hence the PathPrefix in my case was '/servicetest/servicetest.asmx'.

  • Snippet:-----

  • Construct soap request document

CREATE OBJECT osoap.

IF osoap IS INITIAL.

WRITE: / '> cannot create soap document, exiting...'. EXIT.

ENDIF.

TRY.

CALL METHOD osoap->set_method

EXPORTING

nsvalue = 'http://tempuri.org/'

  • attributes =

name = 'HelloWorld'.

  • parameter: Out

GET REFERENCE OF lv_char100_out INTO dref.

CALL METHOD osoap->add_parameter

EXPORTING

  • nsprefix =

  • nsvalue =

  • attributes =

direction = CSoapConstants=>ic_param_out

name = 'HelloWorldResult'

value = dref.

  • use ABAP tag names

CALL METHOD osoap->set_tag_name_format

EXPORTING format = CSoapConstants=>ic_tagfmt_mixcase.

CATCH CSoapExceptionUsage INTO usgEx.

WRITE: / ' > exception occurred'.

exTxt = usgEx->get_text( ).

WRITE: / ' > text: ', exTxt.

EXIT.

ENDTRY.

isoap = osoap.

*Create transport and set payload

TRY.

CALL METHOD CSoapTransport=>new_http_transport

IMPORTING transport = otransp.

CATCH CSoapExceptionResource INTO resEx.

WRITE: / ' > Error creating SOAP xfer object,'.

exTxt = resEx->get_text( ).

WRITE: / ' > text: ', exTxt.

EXIT.

ENDTRY.

*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • Use for nonRFC Webservices

  • SET SOAPACtion

CALL METHOD otransp->set_soapaction

EXPORTING

soapaction = '"http://tempuri.org/HelloWorld"'.

*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

TRY.

CALL METHOD otransp->set_destination_by_name

EXPORTING dest = dest.

....etc....

Former Member
0 Kudos

Hi priceri ,

I need some help from u

I m using the same soapdocument class - methods to acess a webservice from abap

the problem im facing is that ma webservice is in java .. (EJB)

the tags are in small caps (first letter is always in small case )

abap provides us with method of tag_format in which only uppercase n mixcase are possible

is there ne possible way through which i can change the format of the tags to lowercase .... atleast the first letter to lower case .....

thanks

Former Member
0 Kudos

Hi,

Thank you for the link, I have seen that weblog on calling webservices from 6.20 but it doesn't actually answer the question. The author in fact avoids using webservices and reverts to HTTP, passing parameters in the URL, then goes on to provide an example of calling webservices from 6.40 WAS. Both of which are useful options but neither is available to me at the moment. Many thanks in any case.

eddy_declercq
Active Contributor
0 Kudos

Hi,

Pls check /people/thomas.jung3/blog/2005/06/05/web-services-the-case-of-the-missing-soap-action-header

Eddy

athavanraja
Active Contributor
0 Kudos

may be this weblog can help you

/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

Regards

Raja