Standard service - a fixed amount of work that is performed at a fixed price.  Post Service

  

Tuesday, 30 April 2019 17:02

Web Service in SAP – Part IV – XSD Schema Error in External Web Service URL

Written by  https://sapyard.com/web-service-in-sap-part-iv-xsd-schema-error-in-external-web-service-url/
Rate this item
(0 votes)

Many times when we try to create Consumer Proxy for the external Web Service (URL), we get error while accessing the WSDL/Schema. The error can be because of

firewall, trusted network, URL certification or authorization issues. But once all the network and authorization issues are resolved, if you still get error in WSDL/Schema, then it is highly possible that your Web Service URL has the link to Schema Location which it cannot identify at runtime wizard while creating the Consumer Proxy.

Also Read: How to Create, Consume and Troubleshoot SAP Web Service Consumer?

Say you are trying to create consumer proxy in SE80 likeshown below.

You give the name and proceed with the Enterprise ServicesCreate Wizard.

But you are stuck in the step “Enter the URL for accessing the WSDL/Schema”.

Errors can be like below: “500 Internal Server Error”.

Error can be like “500 SSL Peer Certificate Untrusted”.

Error in URL accessing the WSDL/Schema can also be for .XSDlike below.

Sample xsd errors in WSDL URL:

“Error while uploading the xsd file(schema) in web services definition”

“File ContractService.xsd was not attached because it has an invalid file extension not allowed by the system settings”

“Exception occurred in communication framework: Error in HTTP Framework:500Internal Server Error”

“…<WSDL URL>.xsd “ error

by the way XSD means XML Schema Definition

Most of the time, WSDL URL has the hyper link (URL) to the schema location. Instead of the <xsd:schema>definition </xsd:schema>, it has a URL link to schema location where we can see the actual schema definition and properties. In such Web Services, if we try to consume the WSDL URL, we get error. In order to avoid that error, we need to use the WSDL local file. Do not worry, the local WSDL file would be dynamic and would work exactly like the WSDL URL. But we need to do a small tweak in the local WSDL file.

We need to replace the link to schema location with the exact schema definition from the schema location URL in the WSDL local file. Once we have the complete schema definition replaced in the WSDL, we should be able to create the consumer proxy using the local WSDL file.

Also Read:How to Create Web Service in SAP and configure SOAMANANGER?

Below steps would demonstrate in details, how we can replace the xsd schema location with the exact xsd schema definition. We have taken the public dnb toolkit web service for our example.

Step 1 – Refer to below link for dnb WSDL

https://toolkit-api.dnb.com/locked/WSDLEndpoints.asp?stat_link=020201&id=70BCF32F829359890238

We are referring to GDP_V4.wsdl.

Step 2 – Open the Web Service

https://toolkit-api.dnb.com/ws/DNB_WebServices.Providers.OrderAndInvestigations.GDP_V4:wsp_GDP_V4?WSDL

Step 3 – Save the Web Service as .txt file

Save the WSDL file as .txt in your local machine. Screenshot of the txt file opened in wordpad below.

Step 4 – Look for <xsd:schema> Key Word

Take a look at the <xsd:schema>either in the txt file (screenshot above) or on WSDL in browser (screenshot below).

<xsd:schema> </xsd:schema>

Step 5 – Expand <xsd:schema> </xsd:schema>

<xsd:schema><xsd:import namespace=”http://www.dnb.com/DNB_WebServices/Providers/OrderAndInvestigations/GDP_V4/wsp_GDP_V4” schemaLocation=”https://toolkit-wsdl.dnb.com/ws/DNB_WebServices.Providers.OrderAndInvestigations.GDP_V4:wsp_GDP_V4?WSDL&fingerprint=P6DCJGGOL7NVDOIVFGQWX7EKOTZNG45M.xsd” /></xsd:schema>

Step 6 – Look for schemaLoation Key Word and schemaLocation Path

Forthis WSDL the schemaLocation path is:

https://toolkit-wsdl.dnb.com/ws/DNB_WebServices.Providers.OrderAndInvestigations.GDP_V4:wsp_GDP_V4?WSDL&fingerprint=P6DCJGGOL7NVDOIVFGQWX7EKOTZNG45M.xsd

Step 7 – Replace the xsd:schema in the WSDL file with the exact definition from the schemaLocation.

Open the schemaLocation Path URL in another Tab in the browser. It will give the full Type definition of the xsd:schema.

Do not forget to expand all <xsd:sequence> before youcopy the full definition.

Once it is expanded, it is no more yellow.

The easy way to expand all the sequence is by going to page source. Right click on any area and go to View page source

Also Read:Web Service in SAP – Part III – Testing & Investigation Tips

Step 8 – Copy XSD Schema Definition and Replace

Copy the full xsd:schema and replace in the original WSDL.txt file with the xsd:schema from the schemaLocation.

PS: Do not copy the first line of the page source (as marked in image above).

Tips:<xsd:schema> </xsd:schema> should be between <wsdl:types></wsdl:types>.

Step 9 – Save the Web Service file with .WSDL extension

Sample .WSDL image

Step 10 – Choose the WSDL Source as Local File in the Wizard

Now, wherever you were trying to use the WSDL URL, replace it with your local WSDL file. The xsd schema error should be resolved.

Screenshot of sample Consumer Proxy we created.

This should fix the Web Service XSD Schema issue.

Thank you Mastan Raju!!

A special thanks to Mastan Raju, who helped us with a video explaining the root cause. He helped us figuring out the issue and even sent us a sample WSDL file. With his help, we were able to create the consumer proxy from local WSDL file and consume the external Web Service.

If you want to have real time discussions and resolutions, do join our SAP Technical Telegram Group where we have more than 4670+ active SAP consultants from 6 Continents.

Please Note: You need to install Telegram App on your mobile first and then you can join the group using the above link.

Please SUBSCRIBE to SAPYard’s Youtube Channel for Free End to End SAP Video Course and Training.

Step by Step Tutorials on Web Services in SAP

Read 24 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.