--QUOTE-- This fragment: elementFormDefault="qualified" indicates that any elements used by the XML instance document which were declared in this schema must be namespace qualified. --QUOTE--
... and the namespace is the targetNamespace of the schema where the element has been declared (http://APASProxy.ServiceContracts/2007/04), not the namespace of the type (http://APASProxy.DataTypes/2007/04). The type doesn't determine the name of the element, only its content model. If you are still not convinced, think about the following element declaration: <element name="a"> <complexType> <sequence> <element name="b" type="string"/> </sequence> </complexType> </element> According to your reasoning, the element b should have namespace http://www.w3.org/2001/XMLSchema. This is definitely not true. Andreas On Wed, May 13, 2009 at 00:38, Trenton D. Adams <[email protected]> wrote: > Hi Andrea, > > This is really confusing. How can GetHostInstitutionResult not depend on > it's type? If it doesn't depend on it's type, then why have a "type"? > > As far as I can tell, elementFormDefault="qualified" doesn't imply anything > about having the same namespace af the parent. All it tells parsers and > validators, is that if you set it to "qualified" then all of your XML > elements in a document, related to that schema, MUST be prefixed with a > namespace prefix. > > From w3c schools... > --QUOTE-- > This fragment: > elementFormDefault="qualified" > > indicates that any elements used by the XML instance document which were > declared in this schema must be namespace qualified. > --QUOTE-- > > I have tested this locally with perl validation, and it is correct. If I > have formElementDefault="qualified", then this is invalid and fails the xml > validation... > > <document xmlns:blah="blah"> > <a_blah_element> > </a_blah_element> > </document> > > But this is correct, and would succeed on xml validation... > <document xmlns:blah="blah"> > <blah:a_blah_element> > </blah:a_blah_element> > </document> > > The qualification setting has nothing to do with what you said "it must have > the namespace of the schema in which it is declared". The > GetHostInstitutionResult type was declared in a different schema, and that is > the namespace that it should have. So, the XML returned by the service is > indeed correct, but the stub code generated is incorrect. It should be > qualifying it, which it is, but with the "type" that the element was declared > with in the WSDL. > > I hope that makes some sense. > > Thanks. > > Trenton D. Adams > Systems Analyst/Web Software Engineer > Navy Penguins at your service! > Athabasca University > (780) 675-6195 > :wq! > > ----- "Andreas Veithen" <[email protected]> wrote: > >> From: "Andreas Veithen" <[email protected]> >> To: "Trenton D. Adams" <[email protected]> >> Cc: [email protected] >> Sent: Tuesday, May 12, 2009 12:39:34 PM GMT -07:00 US/Canada Mountain >> Subject: Re: axis 2 unexpected Subelement (BUG???) >> >> The namespace of GetHostInstitutionResult doesn't depend on its type. >> Since it appears in a sequence and elementFormDefault="qualified", it >> must have the namespace of the schema in which it is declared, i.e. >> "http://APASProxy.ServiceContracts/2007/04", exactly as the generated >> code expects it. >> >> Andreas >> >> On Tue, May 12, 2009 at 20:29, Trenton D. Adams <[email protected]> >> wrote: >> > Okay, thanks Andreas. I'm not sure I understand completely. The >> GetHostInstitutionResult is supposed to be of the schema type >> "http://APASProxy.DataTypes/2007/04", no??? >> > >> > Anyhow, here's the items you mentioned... >> > <wsdl:types> >> > <schema elementFormDefault="qualified" >> targetNamespace="http://APASProxy.ServiceContracts/2007/04" >> xmlns="http://www.w3.org/2001/XMLSchema"> >> > >> > If the WSDL is wrong, I'm then wondering if this was an axis1 bug, >> as according to the wsdl comment, it was generated by axis 1.4. >> > >> > Thanks. >> > >> > Trenton D. Adams >> > Systems Analyst/Web Software Engineer >> > Navy Penguins at your service! >> > Athabasca University >> > (780) 675-6195 >> > :wq! >> > >> > ----- "Andreas Veithen" <[email protected]> wrote: >> > >> >> From: "Andreas Veithen" <[email protected]> >> >> To: [email protected], "Trenton D. Adams" >> <[email protected]> >> >> Sent: Tuesday, May 12, 2009 12:07:21 PM GMT -07:00 US/Canada >> Mountain >> >> Subject: Re: axis 2 unexpected Subelement (BUG???) >> >> >> >> It is not. The fact that GetHostInstitutionResult is of type >> >> tns1:RegisteredEducationalInstitution doesn't tell anything about >> the >> >> namespace of GetHostInstitutionResult. This depends on the >> >> targetNamespace and elementFormDefault of the schema, which you >> don't >> >> show in your post. >> >> >> >> Andreas >> >> >> >> On Tue, May 12, 2009 at 19:55, Trenton D. Adams >> <[email protected]> >> >> wrote: >> >> > Okay, I figured out what is happening. Is this an axis bug? >> >> > >> >> > It is putting the incorrect schema into the stub code... >> >> > if (reader.isStartElement() >> && >> >> new >> >> >> javax.xml.namespace.QName("http://APASProxy.ServiceContracts/2007/04","GetHostInstitutionResult").equals(reader.getName())){ >> >> > >> >> > >> >> >> object.setGetHostInstitutionResult(RegisteredEducationalInstitution.Factory.parse(reader)); >> >> > >> >> > reader.next(); >> >> > >> >> > } // End of if for expected >> property >> >> start element >> >> > >> >> > else { >> >> > >> >> > } >> >> > >> >> > That "ServiceContracts" should read "DataTypes". The wsdl says >> >> this... >> >> > <?xml version="1.0" encoding="UTF-8"?> >> >> > <wsdl:definitions >> >> targetNamespace="http://APASProxy.ServiceContracts/2007/04" >> >> xmlns:apachesoap="http://xml.apache.org/xml-soap" >> >> xmlns:impl="http://APASProxy.ServiceContracts/2007/04" >> >> xmlns:intf="http://APASProxy.ServiceContracts/2007/04" >> >> xmlns:tns1="http://APASProxy.DataTypes/2007/04" >> >> xmlns:tns2="http://_04._2007.APASProxy.DataTypes" >> >> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >> >> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >> >> > <!--WSDL created by Apache Axis version: 1.4 >> >> > ... >> >> > ... >> >> > <element name="GetHostInstitutionResponse"> >> >> > <complexType> >> >> > <sequence> >> >> > <element name="GetHostInstitutionResult" >> >> type="tns1:RegisteredEducationalInstitution"/> >> >> > </sequence> >> >> > >> >> > </complexType> >> >> > </element> >> >> > >> >> > You will notice that tns1 is correctly linked to the DataTypes >> >> schema, and not the ServiceContracts schema. >> >> > >> >> > >> >> > Trenton D. Adams >> >> > Systems Analyst/Web Software Engineer >> >> > Navy Penguins at your service! >> >> > Athabasca University >> >> > (780) 675-6195 >> >> > :wq! >> >> > >> >> > ----- "Trenton D. Adams" <[email protected]> wrote: >> >> > >> >> >> From: "Trenton D. Adams" <[email protected]> >> >> >> To: [email protected], "Trenton D. Adams" >> >> <[email protected]> >> >> >> Sent: Tuesday, May 12, 2009 10:56:12 AM GMT -07:00 US/Canada >> >> Mountain >> >> >> Subject: Re: axis 2 unexpected Subelement >> >> >> >> >> >> Oops, I was wrong, it wasn't the code below failing, it was the >> >> second >> >> >> attempt using the wsdl2java classes that failed... >> >> >> >> >> >> final APASQueueServiceStub service; >> >> >> service = new APASQueueServiceStub(); >> >> >> APASQueueServiceStub.GetHostInstitution hostInst; >> >> >> hostInst = new >> >> APASQueueServiceStub.GetHostInstitution(); >> >> >> APASQueueServiceStub.GetHostInstitutionResponse resp >> = >> >> >> service.GetHostInstitution(hostInst); >> >> >> System.out.println("Institution: " + >> >> >> >> >> >> >> >> >> resp.getGetHostInstitutionResult().getEducationalInstitutionName()); >> >> >> >> >> >> I can post the WSDL if you like. >> >> >> >> >> >> Trenton D. Adams >> >> >> Systems Analyst/Web Software Engineer >> >> >> Navy Penguins at your service! >> >> >> Athabasca University >> >> >> (780) 675-6195 >> >> >> :wq! >> >> >> >> >> >> ----- "Trenton D. Adams" <[email protected]> wrote: >> >> >> >> >> >> > From: "Trenton D. Adams" <[email protected]> >> >> >> > To: "axis-user" <[email protected]> >> >> >> > Sent: Tuesday, May 12, 2009 9:49:05 AM GMT -07:00 US/Canada >> >> >> Mountain >> >> >> > Subject: axis 2 unexpected Subelement >> >> >> > >> >> >> > Hi Guys, >> >> >> > >> >> >> > I can't figure out why I'm getting this error; is there >> >> something >> >> >> > wrong with the service's XML output? >> >> >> > >> >> >> > ServiceClient client; >> >> >> > client = new ServiceClient(); >> >> >> > Options options = new Options(); >> >> >> > options.setTo(new >> >> >> > >> >> >> >> >> >> EndpointReference("https://apasproxy.athabascau.ca/axis/services/APASQueueService")); >> >> >> > client.setOptions(options); >> >> >> > OMElement request; >> >> >> > OMFactory factory; >> >> >> > factory = OMAbstractFactory.getOMFactory(); >> >> >> > request = factory.createOMElement(new >> >> >> > QName("http://APASProxy.DataTypes/2007/04/", >> >> >> "GetHostInstitution")); >> >> >> > OMElement response; >> >> >> > response = client.sendReceive(request); >> >> >> > System.out.println(response.toString()); >> >> >> > >> >> >> > <GetHostInstitutionResponse >> >> >> > >> >> >> >> >> >> xmlns="http://APASProxy.DataTypes/2007/04/"><ns1:GetHostInstitutionResult >> >> >> > >> >> >> >> >> >> xmlns:ns1="http://APASProxy.DataTypes/2007/04"><ns1:SourceId>48002000</ns1:SourceId><ns1:EducationalInstitutionName>Athabasca >> >> >> > >> >> >> >> >> >> University</ns1:EducationalInstitutionName></ns1:GetHostInstitutionResult></GetHostInstitutionResponse> >> >> >> > org.apache.axis2.AxisFault: >> >> >> org.apache.axis2.databinding.ADBException: >> >> >> > Unexpected subelement GetHostInstitutionResult >> >> >> > at >> org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) >> >> >> > at >> >> >> > >> >> >> >> >> >> servicecontracts.apasproxy._2007._04.APASQueueServiceStub.fromOM(APASQueueServiceStub.java:35302) >> >> >> > at >> >> >> > >> >> >> >> >> >> servicecontracts.apasproxy._2007._04.APASQueueServiceStub.GetHostInstitution(APASQueueServiceStub.java:2467) >> >> >> > at ca.athabascau.apas.APAS.main(APAS.java:70) >> >> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> >> Method) >> >> >> > at >> >> >> > >> >> >> >> >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> >> >> > at >> >> >> > >> >> >> >> >> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> >> >> > at java.lang.reflect.Method.invoke(Method.java:597) >> >> >> > at >> >> >> > >> >> >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> >> >> > Caused by: java.lang.Exception: >> >> >> > org.apache.axis2.databinding.ADBException: Unexpected >> subelement >> >> >> > GetHostInstitutionResult >> >> >> > at >> >> >> > >> >> >> >> >> >> servicecontracts.apasproxy._2007._04.APASQueueServiceStub$GetHostInstitutionResponse$Factory.parse(APASQueueServiceStub.java:12645) >> >> >> > at >> >> >> > >> >> >> >> >> >> servicecontracts.apasproxy._2007._04.APASQueueServiceStub.fromOM(APASQueueServiceStub.java:35226) >> >> >> > ... 7 more >> >> >> > Caused by: org.apache.axis2.databinding.ADBException: >> Unexpected >> >> >> > subelement GetHostInstitutionResult >> >> >> > at >> >> >> > >> >> >> >> >> >> servicecontracts.apasproxy._2007._04.APASQueueServiceStub$GetHostInstitutionResponse$Factory.parse(APASQueueServiceStub.java:12639) >> >> >> > ... 8 more >> >> >> > >> >> >> > Process finished with exit code 0 >> >> >> > >> >> >> > >> >> >> > >> >> >> > Trenton D. Adams >> >> >> > Systems Analyst/Web Software Engineer >> >> >> > Navy Penguins at your service! >> >> >> > Athabasca University >> >> >> > (780) 675-6195 >> >> >> > :wq! >> >> >> > >> >> >> > __ >> >> >> > This communication is intended for the use of the >> recipient >> >> to >> >> >> > whom it >> >> >> > is addressed, and may contain confidential, personal, and >> or >> >> >> > privileged >> >> >> > information. Please contact us immediately if you are not >> >> the >> >> >> > intended >> >> >> > recipient of this communication, and do not copy, >> >> distribute, >> >> >> or >> >> >> > take >> >> >> > action relying on it. Any communications received in >> error, >> >> or >> >> >> > subsequent reply, should be deleted or destroyed. >> >> >> > --- >> >> > >> > >
