Results 1 to 2 of 2

Thread: marshaller problem

  1. #1
    Join Date
    Aug 2008
    Posts
    4

    Default marshaller problem

    Hi, everyone! I have next problem:

    I have next request XML:

    Code:
    <GetQuote xmlns="webserviceX.NET/">
    	<symbol>GOOG</symbol>
    </GetQuote>
    and this XSD:

    Code:
    <schema xmlns="w3.org/2001/XMLSchema"
    		xmlns:tns="webserviceX.NET/"
            elementFormDefault="qualified"
            targetNamespace="webserviceX.NET/">
            
     	<element name="GetQuote">
    		<complexType>
    			<sequence>
    				<element minOccurs="0" maxOccurs="1" name="symbol" type="string"/>
    			</sequence>
    		</complexType>
    	</element>
        
    </schema>
    in build.xml I do so:

    Code:
    <target name="generate" depends="build">
    	        <mkdir dir="${gen.dir}"/>
    	        <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="master-classpath"/>
    	        <xmlbean schema="${schema}" srcgendir="${gen.dir}" classgendir="${bin.dir}" classpathref="master-classpath" javasource="1.5"/>
    	</target>
    and when marshall form generated clasess I get:

    Code:
    <web:GetQuote xmlns:web="webserviceX.NET/">
    	<web:symbol>GOOG</web:symbol>
    </web:GetQuote>
    Why happens so? Can somebody explain me?

  2. #2
    Join Date
    Aug 2008
    Posts
    5

    Default

    Quote Originally Posted by ratzko View Post
    Hi, everyone! I have next problem:

    I have next request XML:

    Code:
    <GetQuote xmlns="webserviceX.NET/">
    	<symbol>GOOG</symbol>
    </GetQuote>
    and this XSD:

    Code:
    <schema xmlns="w3.org/2001/XMLSchema"
    		xmlns:tns="webserviceX.NET/"
            elementFormDefault="qualified"
            targetNamespace="webserviceX.NET/">
            
     	<element name="GetQuote">
    		<complexType>
    			<sequence>
    				<element minOccurs="0" maxOccurs="1" name="symbol" type="string"/>
    			</sequence>
    		</complexType>
    	</element>
        
    </schema>
    in build.xml I do so:

    Code:
    <target name="generate" depends="build">
    	        <mkdir dir="${gen.dir}"/>
    	        <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="master-classpath"/>
    	        <xmlbean schema="${schema}" srcgendir="${gen.dir}" classgendir="${bin.dir}" classpathref="master-classpath" javasource="1.5"/>
    	</target>
    and when marshall form generated clasess I get:

    Code:
    <web:GetQuote xmlns:web="webserviceX.NET/">
    	<web:symbol>GOOG</web:symbol>
    </web:GetQuote>
    Why happens so? Can somebody explain me?
    I see nothing wrong with this. In your first example of the request, you have defined webserviceX.NET/ as the default namespace, and you don't have to prefix the xml elements. In the generated request it is not the default namespace, and hence you have to prefix with the chosen name for the namespace. In this example it is web.

    Everything looks just fine with me

    Regards,
    Ketil Aasarød
    Fundator AS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •