cancel
Showing results for 
Search instead for 
Did you mean: 

XSD restriction in SAP Webservice

Former Member
0 Kudos

Hi,

We are creating webservice on SAP ECC which will be consumed by other system (messages are sending to SAP ECC). We need to implement below requirement:

<xsd:element name="Currency">

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:enumeration value="USD"/>

<xsd:enumeration value="EUR"/>

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

1. We would like to process only those messages (webservices) where Currency = USD or Currency = EUR. for all other values, messages should be rejected by SOAP layer.

2. In WSDL provided by webservice on SAP ECC we would like to have to such information (only USD or EUR - as it is in code above)

Please note that we are not using SAP PI - we have direct connection with SAP ECC by Webservice.

Thanks,

Kari

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

For your second question you can validate using restriction on the xsd. Please refer below standard example

http://www.w3schools.com/schema/schema_facets.asp

If you use PI you can use xml validation in the pipeline step. Since you dont use PI, you cannot handle through pi. But in the processing side at ECC, you can use xml parsers to handle the data against wsdl xsd definition first to catch it before parsing the data at the coding side. That's one approach.

Former Member
0 Kudos

Thank you for your answer.

We don't use SAP PI.

Could be describe me required steps to achieve that ? What I should do on SAP ECC side in order to have such validation in WSDL generated directly from SAP ECC ?

Thanks,

Kari

baskar_gopalakrishnan2
Active Contributor
0 Kudos

As I said before you can validate the data in the ecc coding first and then process the data after successful validation.  The validation can be done using xml parsers. Search online for parsing the data against xsd. Otherwise use the abap coding and validate first and then process next.

agasthuri_doss
Active Contributor
0 Kudos

Kari,

>> We don't use SAP PI.Could be describe me required steps to achieve that ? What I should do on SAP ECC side in order to have such validation in WSDL generated directly from SAP ECC ?

Since you publish from ECC, create the WSDL file and write the validation in the ECC to handle Currency = USD or Currency = EUR

Cheers

Agasthuri

Former Member
0 Kudos

>> We don't use SAP PI.Could be describe me required steps to achieve that ? What I should do on SAP ECC side in order to have such validation in WSDL generated directly from SAP ECC ?

Since you publish from ECC, create the WSDL file and write the validation in the ECC to handle Currency = USD or Currency = EUR

How I can change WSDLe published from SAP ECC ? I transaction SE80 I see WSDL generated by SAP ECC - and I can't change it.

Did You mean that I should write WSDL file to my desktop - then add "<xsd:enumeration value="USD"/>" etc. directly in WSDL and such file publish to other system which will consume my webservice ?

Thanks,

Former Member
0 Kudos

Hi Kari,

I think what the guys mean is that you will need to add some Abap code in ECC to do this validation - i.e. block requests (maybe with the appropriate message to the systems initiating the requests). I'm not aware of Abap being able to handle enumerations but things may hav changes since I last checked - maybe check it against the Abap Forum here on SCN.

I also came across a custom built solution that might help but it will take more time:

http://scn.sap.com/blogs/edward.pelyavskyy2/2010/03/09/validating-xml-with-xml-schema-xsd

Regards, Trevor

Answers (0)