cancel
Showing results for 
Search instead for 
Did you mean: 

Web Services - How to add namespace to parameter?

Former Member
0 Kudos

Hello,

I`m facing problem with "certification verification failed" during sending signed message via web service.

In my opinion it is because element/parameter SIGNATURE in xml is like:

<n2:Signature Id="Signature-0">

and should be:

<n2:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-0">

Originally proxy structure was very complexed element "Signature" so every part we had to put separately.

Now i tried to modify wsdl and set "Signature" as string so we can send only one parameter with correct xml to function module and next to web service.

Now we are able to add everything inside "Signature" but still first element is generated by SAP

Modified WSDL part is like:

      <xs:element name="UploadRequest">

        <xs:complexType>

          <xs:sequence>

                              <xs:element minOccurs="0" name="Signature" type="xs:string"/>

          </xs:sequence>

        </xs:complexType>

      </xs:element>

so in SAP under request parameter we have only Signature type string.

My question is:

Is it possible to add namespace xmlns:ds="http://www.w3.org/2000/09/xmldsig#" to "Signature"?

If so how can I do this?

Best regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Since I have not much experience with XSLT mapping I think I need more help.

What I have done and how it works now:

1. Created Service Consumer under SE80 (using wsdl file)

2. Created SM59 connection and logical port via LPCONFIG

While using webservice we are using function module. For example it is:

FUNCTION Z***UPLOAD***.

*"----------------------------------------------------------------------

*"*"Lokalny interfejs:

*"  IMPORTING

*"     VALUE(PRT_NAME) TYPE  SRT_LP_NAME

*"     VALUE(REQUEST) TYPE  Z_UPLOAD_REQUEST

*"  EXPORTING

*"     VALUE(DOCUMENT) TYPE  Z_DOCUMENT16

*"     VALUE(ERROR_TEXT) TYPE  STRING

*"  EXCEPTIONS

*"      SYSTEM_FAILURE

*"      COMMUNICATION_FAILURE

*"----------------------------------------------------------------------

DATA:

      dummy TYPE STRING,

      fault TYPE REF TO cx_ai_system_fault.

DATA: Z_PROXY_CLIENT TYPE REF TO Z_CO_SERVICES .

TRY.

     CREATE OBJECT Z_PROXY_CLIENT

   EXPORTING

     LOGICAL_PORT_NAME  = PRT_NAME.

   CATCH CX_AI_SYSTEM_FAULT .

ENDTRY.

    data: UPLOAD_RESPONSE type Z_UPLOAD_RESPONS .

    data: UPLOAD_REQUEST type Z_UPLOAD_REQUEST .

    REQUEST-SIGNATURE = '<ds:SignedInfo Id="ID-for_testing"></ds:SignedInfo>'.


MOVE REQUEST-SIGNATURE TO UPLOAD_REQUEST-SIGNATURE.

TRY.

CALL METHOD Z_PROXY_CLIENT->UPLOAD

   EXPORTING

     UPLOAD_REQUEST  = UPLOAD_REQUEST

   IMPORTING

     UPLOAD_RESPONSE = UPLOAD_RESPONSE

     .

  CATCH CX_AI_SYSTEM_FAULT INTO fault.

   dummy = fault->errortext.

   MOVE dummy to ERROR_TEXT.

  CATCH CX_AI_APPLICATION_FAULT .

ENDTRY.

MOVE UPLOAD_RESPONSE-DOCUMENT TO DOCUMENT.

ENDFUNCTION.

Now in srt_util I can see that PI is sending xml as

...

<n0:Signature><ds:SignedInfo Id="ID-for_testing"></ds:SignedInfo></n0:Signature>

...

Where do I have to use this XSLT to add namespace?

former_member184789
Active Contributor
0 Kudos

Hi,

The XSLT mapping will be added within PI configuration. While the message passes through PI, the XSLT mapping will add this namespace before sending it to the receiver system. You can refer to the links in my previous post as to how the XSLT mapping will be added within PI.

Former Member
0 Kudos

I have checked all the links above but there is no step-by-step info how to do this.

I have found: http://www.riyaz.net/sap/sap-pi-abap-mapping-simplified/837/ and done "Writing Your First ABAP Mapping Class".

I don`t know how to do step: "Implementing ABAP mapping in SAP PI".

..but next step should me mapping.

According to: http://scn.sap.com/thread/3174199

I can implement something simillar to: http://www.sachinhandiekar.com/2011/12/remove-namespace-using-xslt.html in tcode: XSLT_TOOL

I have also found quite old guide without screenshots: http://scn.sap.com/people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping

To sum up:

I have created new mapping class.

I know that mapping simillar to: http://www.sachinhandiekar.com/2011/12/remove-namespace-using-xslt.html should be developed under XSLT_TOOL

But how to make it complete and working?

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You create XSLT mapping and specify this mapping in the operation mapping after your message mapping. The sequence is first message mapping and followed by XSLT.   You basically create xslt mapping externally  and import it in PI, Please refer SCN for adding namespace using XSLT. You will see plenty of threads.

Former Member
0 Kudos

Hi,

Could you tell me where this "message mapping" should be done?

IS it via TCODE in SAP? If so please provide one...

former_member184789
Active Contributor
0 Kudos

Hi Mariusz,

PI mappings are not done via transaction codes. You have to log into the PI system & open the PI tools page by transaction sxmb_ifr. There we have the Enterprise service builder & Integration directory where the PI configuration is done as per the previous posts.

Former Member
0 Kudos

Hi,

Finally I have access to PI - ESR.

Since I have no experience with it could you please tell we where should I start doing XSLT mapping? Maybe there is any tutorial with screens?

Using sxmb_ifr I have view as following:

In ESR - Enterprise Services Builder there is:

and in: ID - Integration Builder:

Best regards

former_member184789
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

But, is it possible when all proxy structures are generated by SAP based on imported wsdl + xsd?

As I can see in SE80 there is assigned XSLT transformation generated by SAP and I can not change it.

Or maybe it is possible to attach other transformations somewhere else?

I would appreciate your help.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>But, is it possible when all proxy structures are generated by SAP based on imported wsdl + xsd?

You don't need to make any change in the proxy or sender system. You use the structure you have from the wsdl. You just add this namespace in the mapping step and so before you call the web service you have this namespace .

>Or maybe it is possible to attach other transformations somewhere else?

Do it in the mapping step. You can use xslt mapping or java mapping.

former_member184789
Active Contributor
0 Kudos

Hi,

As Baskar already said, the XSLT mapping will be applied during the mapping step in PI. The below tutorials explain how the XSLT mapping is added in PI:

http://saptechnical.com/Tutorials/XI/XSLT/page1.htm

http://scn.sap.com/docs/DOC-3824

& for your requirement, you can refer to the links which I gave in my previous post.