axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: axis 2 unexpected Subelement (BUG???)
Date Tue, 12 May 2009 18:39:34 GMT
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 <trenta@athabascau.ca> 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" <andreas.veithen@gmail.com> wrote:
>
>> From: "Andreas Veithen" <andreas.veithen@gmail.com>
>> To: axis-user@ws.apache.org, "Trenton D. Adams" <trenta@athabascau.ca>
>> 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 <trenta@athabascau.ca>
>> 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" <trenta@athabascau.ca> wrote:
>> >
>> >> From: "Trenton D. Adams" <trenta@athabascau.ca>
>> >> To: axis-user@ws.apache.org, "Trenton D. Adams"
>> <trenta@athabascau.ca>
>> >> 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" <trenta@athabascau.ca> wrote:
>> >>
>> >> > From: "Trenton D. Adams" <trenta@athabascau.ca>
>> >> > To: "axis-user" <axis-user@ws.apache.org>
>> >> > 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.
>> >> > ---
>> >
>

Mime
View raw message