cancel
Showing results for 
Search instead for 
Did you mean: 

XML Namespace in WebService Request/Response

Former Member
0 Kudos

Hi all,

I have a question regarding xml namespace usage in wsdl and the corresponding request/response messages.

I have already browsed quite some articles about xml namespaces as well as some forum threads, but I am still not sure.

I have the following part of a wsdl document (generated by Integration Directory), defining a targetnamespace.

u2026
<wsdl:types>
    <xsd:schema targetNamespace="http://www.dorma.com/sap/xi/finance"
                         xmlns="http://www.dorma.com/sap/xi/finance"
                         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="DebtorGetDetailResponse" type="Z_BAPI_DEBTOR_GETDETAIL_Response"></xsd:element>
        u2026
        <xsd:complexType name="Z_BAPI_DEBTOR_GETDETAIL_Response">
            <xsd:sequence>
                <xsd:element name="DEBITOR_COMPANY_DETAIL" type="BAPI1007_5" minOccurs="0">
                    ...
                </xsd:element> u2026
            </xsd:sequence>
        </xsd:complexType>
        u2026
    </xsd:schema>
    u2026
</wsdl:types>
u2026

In my understanding, all types defined in the schema section of a wsdl document will be in the targetnamespace, if defined.

Therefore the element DEBITOR_COMPANY_DETAIL would be in the namesapce

http://www.dorma.com/sap/xi/finance

.

However, the ABAP proxy generates a response message like follows,

where only the root element is in this namespace and the child elements are in the global namespace:

<?xml version="1.0" encoding="utf-8"?>
<ns1:DebtorGetDetailResponse xmlns:ns1="http://www.dorma.com/sap/xi/finance"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <DEBITOR_COMPANY_DETAIL>
        u2026
    </DEBITOR_COMPANY_DETAIL>
    u2026
</ns1:DebtorGetDetailResponse>

Do I have a wrong understand of the wsdl (xml schema) or is this an erroneous behavior?

The problem is that some 3rd-party software web service module does not accept

the response message as not complient with the respective wsdl document.

Any input is appreciated.

Thanks

Hans

Edited by: Hans-Jürgen Schwippert on Oct 1, 2008 12:02 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey

I have had problems with the XML namespace as well. The only way (for me) to come around this problem has been to create an ABAP or XSLT mapping to remove the unwanted namespaces from the result XML that is returned to the receiver.

If you need some examples of how to remove these namespaces I can give you that, but unfortunately I am not comfortable enough with these namespaces to say if you have the correct understanding or not..

regards Ole

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

There is no real solution to it, because it is no real error. SAP qualifies only the root elements with namespaces (e. g. BAPI-calls), all the inner elements are general, unqualified elements. Therefore the generated XML (XI/PI adapter or proxy) is syntactically correct.

However, our 3rd party product which had problems parsing the generated data has been patched to allow this (permitted) behaviour.

Kind regards

Hans

Former Member
0 Kudos

Hi ,

There is a simple transformation program associated with each ABAP proxy. The simple transformation program maps the correspond XML elements to the ABAP data types and vice versa.

This implies that you can take a look at the simple transformation program and try to change it according to your needs.

Former Member
0 Kudos

Thanks for your reply, but I am not using an ABAP proxy. I am using Web Dynpro for java to connect to a third party webservice running outside the SAP landscape. I have imported the WSDL document for this WS in an Adaptive WS model.

Is there a way to force web dynpro to add namespace to all elements?

Former Member
0 Kudos

Hi,

use the "XMLAnonymizerBean" Adapter Freamwork module.It will solve your problem.

[http://help.sap.com/saphelp_nw70/helpdata/EN/45/d169186a29570ae10000000a114a6b/content.htm]

Regards,

Prakasu

Former Member
0 Kudos

Hi Prakasu

Thank you for your reply. However, as I stated above, I do not want to anonymize my payload but rather qualify each element. The other case I found in at least 10 threads.

Thanks anyway!

Hans

Former Member
0 Kudos

I have the same problem. I am trying to connect to a webservice running on IBM websphere but it doesn't accept the xml in my request. It appears to be the same namespace issue.

Did you ever find a solution for this?

Is it a valid webservice call if you omit the namespace for an element or is this a bug in the Adaptive WS implementation?

Web Dynpro web service model generated request:

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<SOAP-ENV:Header>

<sapsess:Session xmlns:sapsess="http://www.sap.com/webas/630/soap/features/session/">

<enableSession>true</enableSession>

</sapsess:Session>

</SOAP-ENV:Header>

<SOAP-ENV:Body>

-


look between these lines -


<ns1:tamKontrolleraKontoLastAnrop xmlns:ns1="http://schemas.fora.se/modell/tam/1.0/TAM_Data">

<AnvandarNamn>30039647</AnvandarNamn>

</ns1:tamKontrolleraKontoLastAnrop>

-


look between these lines -


</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

As you can see the tag

<AnvandarNamn>30039647</AnvandarNamn>

is missing a namespace.

It should be

<ns1:AnvandarNamn>30039647</ns1:AnvandarNamn>

Using a third part tool called Soapui i generate this request that works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tam="http://schemas.fora.se/modell/tam/1.0/TAM_Data">

<soapenv:Header/>

<soapenv:Body>

<tam:tamKontrolleraKontoLastAnrop>

<tam:AnvandarNamn>30039647</tam:AnvandarNamn>

</tam:tamKontrolleraKontoLastAnrop>

</soapenv:Body>

</soapenv:Envelope>

Former Member
0 Kudos

Hi Ole

Thanks for your answer. I was already afraid that there is no solution to this problem but a mapping. In my case it will be a mapping to qualify all elements (add the missing namespace prefixes) as we want all elements to be qualified, as the interface is a public one and it should match the generated WSDL.

Still, I am curious to know whether my understanding of namespaces as described above is correct or if not, where my error is.

Thanks

Hans