I haven't received any responses to this question.  Is there anyone that
can assist?  Thanks, Jeff

 

  _____  

From: Jeff Andersen 
Sent: Friday, April 27, 2007 4:45 PM
To: [email protected]
Subject: [xfire-user] Adding DOMInHandler results in "Duplicate
attribute" error

 

Hi,

 

I'm having a problem when I add the DOMInHandler to my web service.  My
web service is using XMLBeans and I'm using Spring to configure it.  All
works as expected when I have no DOMInHandler.  Adding the DOMInHandler
results in the following error upon calling the validate method of
XMLBean object, although the SOAP request has only one "orderId"
attribute:

 

    Duplicate attribute: orderId in element
[EMAIL PROTECTED]://www.posportal.com

    

This is the schema I'm using:

 

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

    <xs:schema 

        elementFormDefault="qualified" 

        targetNamespace="http://www.posportal.com"; 

        xmlns:xs="http://www.w3.org/2001/XMLSchema";

        xmlns:tns="http://www.posportal.com";>

      <xs:element name="GetPerson" type="tns:personType"/>

      <xs:complexType name="personType">

        <xs:sequence>

          <xs:element name="ethnicity" type="xs:string"/>

              <xs:element name="sex" type="xs:string"/>

        </xs:sequence>

        <xs:attribute name="orderId" use="required" type="xs:string"/>

      </xs:complexType>

    </xs:schema>

 

I've then written a service with the following interface and class:

 

    public interface Person {

        public GetPersonDocument GetPersonDoc(GetPersonDocument body,
MessageContext mCtx);

    }

    public class PersonImpl implements Person {

 

        public GetPersonDocument GetPersonDoc(GetPersonDocument body,
MessageContext mCtx){

               ArrayList errors=new ArrayList();

               XmlOptions validateOptions = new XmlOptions();

               validateOptions.setErrorListener(errors);  

               String sError="";

               if (!body.validate(validateOptions)) {

                    for (int i = 0; i < errors.size(); i++) {

                        XmlError xmlError = (XmlError) errors.get(i);

                        sError=sError + " ----- " +
xmlError.getMessage();

                    }           

               }

               GetPersonDocument resp=body;

               

               if(sError.length()>0){

                   System.out.println(sError);

                   resp.getGetPerson().setSex(sError);

               }

                return resp;

        } 

        

    }

 

The service is configured as follows:

 

    <bean id="xfirePerson"
class="com.posportal.ws.xfire.person.PersonImpl"/>

 

    <bean name="Person"
class="org.codehaus.xfire.spring.remoting.XFireExporter">

        <property name="serviceBean" ref="xfirePerson" />

        <property name="serviceClass">

            <value>com.posportal.ws.xfire.person.Person</value>

        </property>

        <property name="serviceFactory">

            <ref bean="xfire.xmlbeansServiceFactory"/>

        </property>

        <property name="inHandlers">

          <list>

            <ref bean="DOMInHandler"/>

          </list>

        </property>  

    </bean> 

    

    <bean id="DOMInHandler"
class="org.codehaus.xfire.util.dom.DOMInHandler"/>

 

Below is the SOAP request I'm submitting:

 

    <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:pos="http://www.posportal.com";>

       <soapenv:Header/>

       <soapenv:Body>

          <pos:GetPerson orderId="123">

             <pos:ethnicity>sonoras imperio</pos:ethnicity>

             <pos:sex>quae divum incedo</pos:sex>

          </pos:GetPerson>

       </soapenv:Body>

    </soapenv:Envelope>

    

I've tried searching Google and the various XFire resources, but have
found no indication of this issue.  Any advice would be greatly
appreciated.

 

Thanks,

Jeff

Reply via email to