Question : How to move XML namespaces to SOAP header in Webservice proxy (From WSDL file)

I'm having a major problem connecting with SAP WebServices since it has been decided to use PI/XI as the SAP frontend for accessing the WebService.

Why? Because PI/XI demands that all namespaces used has to be defined in the SOAP:envelope and because Visual Studio creates a proxy which attached the namespaces as attribute to the xml tag. There is no problem using the Visual Studio style calling the SAP WebServices directly

The scenario:

- Visual Studio 2008
- .NET Framework 3.5
- VB.NET

1. We get a WSDL file from the SAP team
2. We add a Web Reference in Visual Studio using the WSDL file.
3. We fill out the parameters
4. We call the WebService
5. We expect a well formed SOAP reponse with SAP data

This is an example of the SOAP envelope while calling the WebService from Visual Studio:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   
      aByElementsQuery_sync xmlns="http://sap.com/xi/APPL/SE/Global">
         aSelectionByElements xmlns="">
           
               I</InclusionExclusionCode>
               1lBoundaryTypeCode>
               99999999</LowerBoundaryID>
           

            0000999999yerPartyInternalID>
            0001</SalesOrganisationID>
            edIndicator>falseifeCycleStatusNotCompletedIndicator>
         taSelectionByElements>
         derList_Header xmlns="urn:solar-eu:document:enhancement_esa:messages">
            1stIndicator>
         rderList_Header>
      taByElementsQuery_sync>
   



The important thing to notice here is the xlmns attributes for  aByElementsQuery_sync> and
 derList_Header>

This is Visual Studio style, and this generates a java exception in the PI/XI

When using the freeware tool SoapUI it creates the following soap enveloper:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:glob="http://sap.com/xi/APPL/SE/Global" xmlns:urn="urn:solar-eu:document:enhancement_esa:messages">
   
      icDataByElementsQuery_sync>
         aSelectionByElements>
           
               P</InclusionExclusionCode>
               1lBoundaryTypeCode>
               99999999</LowerBoundaryID>
           

            0000999999yerPartyInternalID>
            0001</SalesOrganisationID>
            edIndicator>falseifeCycleStatusNotCompletedIndicator>
         taSelectionByElements>
         s_OrderList_Header>
            1stIndicator>
         es_OrderList_Header>
      sicDataByElementsQuery_sync>
   



The important thing to notice here is that the xmlns's has been moved to the and it use prefixes (glob., urn:) to attach the namespace to the xml tags.

THIS WORKS WITH XI/PI and it returns data !!!

So my qustions is:

1. Is it possible to somehow change the way Visual Studio attach namespaces in the soap request while autogenerating the code from the WSDL file, so that it reflects the wau SoapUI does it?

2. Is it possible to manually change the autogenerated code, to do the same as SoapUI?

3. Is it possoble to change the the was to soap request is build in runtime?


I really really hope that there is someone out there who can point me in the right direction or even provide me with the solution.

if not I have to handcode a LOT of SAP webservice calls, from scratch !!!

Answer : How to move XML namespaces to SOAP header in Webservice proxy (From WSDL file)

I have already created my own generic solution using SoapExtension in .NET.
Random Solutions  
 
programming4us programming4us