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