Hi, your WSDL contains several errors and inconsistency and I highly suspect that is causing the problem.
For example, you are defining all the elements in the mobie namespace http://webservice.nms.mobie.com, but you are referecing them using the mobieData namespace http://webservice.common.mobie.com. One of them is SatelliteState which you are having the problem with. There are also a few mismatched wsdl:operation tags. The mismatched tags might haven been caused by pasting to the mail message. So, one way to fix your WSDL is to correct the mismatched wsdl:operation tags and replace prefix mobieData with prefix monbie in the element references so that those in schema defined elements are referenced. Then you should be able to intanticate SatelliteState from the mobie package, that is "com.mobie.nms.webservice.SatelliteState". If you want to have the mobieData package name, you should change the schema accordingly. In any case, you might want to check your WSDL is valid using another tool before using it in your program. regards, aki 2011/7/1 Pedro Alípio <[email protected]>: > Hi! > > I'm using cxf 2.4.1. > > The WSDL is the following: > > > <?xml version="1.0" encoding="UTF-8"?> > <wsdl:definitions targetNamespace="http://webservice.nms.mobie.com" > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > xmlns:mobieData="http://webservice.common.mobie.com" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:mobie="http://webservice.nms.mobie.com" > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> > <wsdl:types> > <xsd:schema targetNamespace="http://webservice.nms.mobie.com"> > <xsd:import namespace="http://webservice.common.mobie.com"/> > <xsd:element name="statusChangedRequest"> > <xsd:complexType> > <xsd:sequence> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="1" > ref="mobieData:ChargingStationState"/> > </xsd:sequence> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="statusChangedResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="0" > ref="mobieData:ResponseError"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="ChargingStationState"> > <xsd:complexType> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="1" > name="centralStationUniqueId" type="xsd:string"/> > <xsd:element maxOccurs="1" minOccurs="1" name="energyState" > type="xsd:int"/> > <xsd:element maxOccurs="1" minOccurs="1" name="functionalState" > type="xsd:int"/> > <xsd:element maxOccurs="unbounded" minOccurs="0" > name="additionalState" type="xsd:int"/> > <xsd:element maxOccurs="1" minOccurs="1" > name="stateChangeTimestamp" type="xsd:string"/> > <xsd:element maxOccurs="unbounded" minOccurs="1" > ref="mobieData:SatelliteState"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="SatelliteState"> > <xsd:complexType> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="1" > name="satelliteStationUniqueId" type="xsd:string"/> > <xsd:element maxOccurs="1" minOccurs="1" name="energyState" > type="xsd:int"/> > <xsd:element maxOccurs="1" minOccurs="1" name="functionalState" > type="xsd:int"/> > <xsd:element maxOccurs="unbounded" minOccurs="0" > name="additionalState" type="xsd:int"/> > <xsd:element maxOccurs="1" minOccurs="1" > name="stateChangeTimestamp" type="xsd:string"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="ResponseError"> > <xsd:complexType> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="1" name="errorCode" > type="xsd:string"/> > <xsd:element maxOccurs="1" minOccurs="1" name="errorMsg" > type="xsd:string"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> > </wsdl:types> > <wsdl:message name="statusChangedResponse"> > <wsdl:part name="parameters" element="mobie:statusChangedResponse"> > </wsdl:part> > </wsdl:message> > <wsdl:message name="statusChangedRequest"> > <wsdl:part name="parameters" element="mobie:statusChangedRequest"> > </wsdl:part> > </wsdl:message> > <wsdl:portType name="WsChargingStationNmsPortType"> > <wsdl:operation name="statusChanged"> > <wsdl:input message="mobie:statusChangedRequest"> > </wsdl:input> > <wsdl:output message="mobie:statusChangedResponse"> > </wsdl:output> > </wsdl:portType> > <wsdl:binding name="WsChargingStationNmsBinding" > type="mobie:WsChargingStationNmsPortType"> > <soap:binding style="document" > transport="http://schemas.xmlsoap.org/soap/http"/> > <wsdl:operation name="authorizationCard"> > <wsdl:operation name="statusChanged"> > <soap:operation soapAction="statusChanged" style="document"/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > </wsdl:operation> > </wsdl:binding> > <wsdl:service name="WsChargingStationNmsService"> > <wsdl:port name="WsChargingStationNmsBinding" > binding="mobie:WsChargingStationNmsBinding"> > <soap:address > location="http://localhost:8088/proxy/ChargingStationNmsServices"/> > </wsdl:port> > </wsdl:service> > </wsdl:definitions> > > > > > > > On Thu, 30 Jun 2011 18:01:53 +0100, Aki Yoshida <[email protected]> > wrote: > >> Hi, >> >> I think this has probably something to do with your speicific wsdl >> file. Can you provide your wsdl file and also the version number of >> cxf you are using? >> >> regards, aki >> >> 2011/6/29 Pedro Alípio <[email protected]>: >>> >>> Hi! I would really appreciate if someone could help me on this. >>> >>> I'm running this simple Dynamic Client: >>> >>> import org.apache.cxf.endpoint.Client; >>> import org.apache.cxf.endpoint.dynamic.DynamicClientFactory; >>> import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; >>> >>> import java.lang.reflect.InvocationTargetException; >>> import java.lang.reflect.Method; >>> import java.util.ArrayList; >>> import java.util.List; >>> >>> >>> public class DynamicClientTest { >>> >>> public static void main(String args[]) { >>> ClassLoader >>> classLoader=DynamicClientTest.class.getClassLoader(); >>> Thread.currentThread().setContextClassLoader(classLoader); >>> >>> JaxWsDynamicClientFactory dcf = >>> JaxWsDynamicClientFactory.newInstance(); >>> >>> Client client = >>> >>> dcf.createClient("http://localhost:8088/proxy/ChargingStationNmsServices?wsdl", >>> classLoader); >>> >>> Object satelliteState; >>> try { >>> satelliteState = >>> >>> Thread.currentThread().getContextClassLoader().loadClass("com.mobie.common.webservice.SatelliteState").newInstance(); >>> } catch (InstantiationException e) { >>> // TODO Auto-generated catch block >>> e.printStackTrace(); >>> } catch (IllegalAccessException e) { >>> // TODO Auto-generated catch block >>> e.printStackTrace(); >>> } catch (ClassNotFoundException e) { >>> // TODO Auto-generated catch block >>> e.printStackTrace(); >>> } >>> } >>> } >>> >>> And I get the following exception: >>> >>> >>> Jun 29, 2011 12:52:17 PM org.apache.cxf.jaxb.JAXBUtils >>> logGeneratedClassNames >>> INFO: Created classes: com.mobie.nms.webservice.AuthorizationCardRequest, >>> com.mobie.nms.webservice.AuthorizationCardResponse, >>> com.mobie.nms.webservice.ChargeFinalizedRequest, >>> com.mobie.nms.webservice.ChargeFinalizedResponse, >>> com.mobie.nms.webservice.ChargeInitializedRequest, >>> com.mobie.nms.webservice.ChargeInitializedResponse, >>> com.mobie.nms.webservice.InstallStationRequest, >>> com.mobie.nms.webservice.InstallStationResponse, >>> com.mobie.nms.webservice.ObjectFactory, >>> com.mobie.nms.webservice.OfflineChargesRequest, >>> com.mobie.nms.webservice.OfflineChargesResponse, >>> com.mobie.nms.webservice.OfflineStatusChangesRequest, >>> com.mobie.nms.webservice.OfflineStatusChangesResponse, >>> com.mobie.nms.webservice.ReportAlarmRequest, >>> com.mobie.nms.webservice.ReportAlarmResponse, >>> com.mobie.nms.webservice.ReportFirmwareUpdateStatusRequest, >>> com.mobie.nms.webservice.ReportFirmwareUpdateStatusResponse, >>> com.mobie.nms.webservice.StatusChangedRequest, >>> com.mobie.nms.webservice.StatusChangedResponse, >>> com.mobie.common.webservice.Alarm, >>> com.mobie.common.webservice.ChargeFinalized, >>> com.mobie.common.webservice.ChargeInitialized, >>> com.mobie.common.webservice.ChargingStationDetails, >>> com.mobie.common.webservice.ChargingStationState, >>> com.mobie.common.webservice.ObjectFactory, >>> com.mobie.common.webservice.OfflineChargeTransaction, >>> com.mobie.common.webservice.ResponseError, >>> com.mobie.common.webservice.SatelliteDetails, >>> com.mobie.common.webservice.SatelliteState >>> java.lang.ClassNotFoundException: >>> com.mobie.common.webservice.SatelliteState >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202) >>> at java.security.AccessController.doPrivileged(Native Method) >>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190) >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306) >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247) >>> at DynamicClientTest.main(DynamicClientTest.java:25) >>> >>> I works for some classes. However I cannot get an instance of >>> SatelliteState >>> and some methods are missing on the ChargingStationState instance. >>> >>> As you can see the "com.mobie.common.webservice.SatelliteState" is being >>> created as it is included in the the generated class names but I cannot >>> instantiate it. Does anyone know what's happening and any workaround? >>> >>> >>> Thanks in advanced, >>> >>> -- >>> Pedro Alípio >>> <[email protected]> >>> > > > -- > Pedro Alípio > <[email protected]> >
