Pramod Kumar
Pramod Kumar

Reputation: 71

JAX WS xsd:any type is an XMLSchema element

Handling xsd:any type is an XMLSchema element JAX WS

<types>
<schema targetNamespace="http://www.iona.com/artix/wsdl"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="unmappedType">
<sequence>
<xsd:any namespace="##other"
processContents="skip"/>
</sequence>
</complexType>
<element name="request" type="tns:requestType"/>
</schema>
</types>

The xml is there as a STring how to have it as a document object, and then transfer its contents into a SOAPElement instance

Need guidance for the implementation and client code.

Convertng the XML String into the Element. and also reading it back once the response is received .

Upvotes: 1

Views: 2192

Answers (1)

Petru Gardea
Petru Gardea

Reputation: 21638

I see that someone has downvoted your question... If you don't mind, I would first point out the issues your question seems to have: the snippet most likely comes from an WSDL, but the schema is rather invalid. The first thing you should do is to make it right. Maybe something like this:

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<schema targetNamespace="http://www.iona.com/artix/wsdl" xmlns:tns="http://www.iona.com/artix/wsdl" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <complexType name="unmappedType">
        <sequence>
            <any namespace="##other" processContents="skip"/>
        </sequence>
    </complexType>
    <element name="request" type="tns:unmappedType"/>
</schema>

Once you've done it, I suggest making up an XML that looks the way you want; make sure you validate that. Post it along with your question...

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.iona.com/artix/wsdl">
    <any_element xmlns="otherNS">anyType</any_element>
</request>

I would then use a tool that's free and easy to use when it comes to JAXB (I recommend NetBeans, it has a straightforward interface). Then write a small Java console app that uses your code; debug through, and see what you get when you unmarshall the XML. Maybe read a little bit the documentation, and then eventually post to ask for help with a more specific question.

The xsd:any and JAXB is pretty well documented: try this about JAXB...

Upvotes: 2

Related Questions