Announcement Announcement Module
Collapse
No announcement yet.
marshaller problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X