Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

WSDL with message from two different namespaces

843833Aug 28 2007 — edited Aug 28 2007
Trying to follow a contract-first approach for creating web services. I got stuck when created the following WSDL (I didn't finish as I ran into a problem with the types/schema tags):
<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions name="MyWebService"
    targetNamespace="http://web.foobar.com"
    xmlns:tns="http://web.foobar.com"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <!-- T Y P E S -->
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://transactions.foobar.com"
            xmlns="http://transactions.foobar.com"
            elementFormDefault="qualified">

            <xsd:element name="Transactions">
                <xsd:complexType>
                    <xsd:sequence maxOccurs="10">
                        <xsd:element name="Transaction" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
           
        </xsd:schema>
       
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://web.foobar.com"
            xmlns="http://web.foobar.com"
            xmlns:txn="http://transactions.foobar.com"
            elementFormDefault="qualified">
           
            <xsd:element name="processTransactionsInput" type="processTransactionsInputType"/>

            <xsd:complexType name="processTransactionsInputType">
                <xsd:sequence>
                    <!-- Does not like referencing from the previous schema tag -->
                    <xsd:element ref="txn:Transactions"/>

                    <!-- This one is okay cuz it is easy -->
                    <xsd:element name="SendDate" type="xsd:date"/>
                </xsd:sequence>
            </xsd:complexType>
           
        </xsd:schema>
    </wsdl:types>
</wsdl:definitions>
I get the following warning when running WsImport using JAX-WS RI 2.1.1:
[WARNING] src-resolve.4.2: Error resolving component 'txn:Transactions'. It was detected that 'txn:Transactions' is in namespace 'http://transactions.foobar.com', but components from this namespace are not referenceable from schema document 'file:/C:/foobar/MyWebService.wsdl#types?schema2'. If this is the incorrect namespace, perhaps the prefix of 'txn:Transactions' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/C:/foobar/MyWebService.wsdl#types?schema2'.
I have one XML object "Transactions" is in different namespace as my web service.

Transactions has the following namespace: http://transactions.foobar.com
My web service has the following namespace: http://web.foobar.com

The actual message my web service needs is a "Transactions" object AND a timestamp. These two together form the input message to my web service.

What's going on here?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2007
Added on Aug 28 2007
1 comment
275 views