I'm working on a project that involves a simple web service, and have had a slew of little problems. It's an Apache CXF webservice (using JAX-WS, over SOAP). The service itself is pretty simple: receive a request, insert the request into a database, and return whether the insert was successful. I'd like to rely on XML validation to enforce a number of constraints on the request.
Full XML validation is very important to this project. So far, I've been unable to properly validate, though my service otherwise functions.
I'm pretty sure it all boils down to this error, which is preventing validation.
Feb 8, 2010 4:47:14 PM org.apache.cxf.wsdl.EndpointReferenceUtils createSchema
WARNING: SAXException for newSchema() on
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.endEntity(XMLDocumentFragmentScannerImpl.java:905)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:605)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1393)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1763)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipSpaces(XMLEntityScanner.java:1492)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:442)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:277)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:435)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:491)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:510)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1802)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:1757)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:909)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:569)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:210)
at org.apache.cxf.wsdl.EndpointReferenceUtils.createSchema(EndpointReferenceUtils.java:666)
at org.apache.cxf.wsdl.EndpointReferenceUtils.getSchema(EndpointReferenceUtils.java:690)
at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.setSchemaInMessage(AbstractInDatabindingInterceptor.java:109)
at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:94)
at org.apache.cxf.interceptor.AbstractInDatabindingInterceptor.getDataReader(AbstractInDatabindingInterceptor.java:99)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:66)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:406)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Feb 8, 2010 4:47:14 PM org.apache.cxf.wsdl.EndpointReferenceUtils createSchema
WARNING: Schema for: http://myproject.com/ws/schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:ns1="http://myproject.com/Schema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://myproject.com/ws/schema" version="1.0">
<xs:import namespace="http://myproject.com/Schema.xsd"/>
<xs:element name="InvalidDataFault" type="xs:string"/>
<xs:element name="RequestHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="UserID" type="xs:string"/>
<xs:element name="Password" type="xs:string"/>
<xs:element name="CourtID" type="xs:positiveInteger"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SecurityFault">
<xs:complexType>
<xs:sequence>
<xs:element name="user" type="xs:string"/>
<xs:element name="court" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uploadData">
<xs:complexType>
<xs:sequence>
<xs:element ref="ns1:DataPackage"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uploadDataResponse" type="xs:anyType"/>
</xs:schema>
Anyone have any ideas?
Any chance you can try with the latest CXF snapshots? There was a bug in this area that was fixed last week related to creating schemas for validation from relatively large schemas. The fix for that may solve this as well.
Related
I have to generate separate wsdl for separate client.
entry.xsd -> entry.wsdl
migration.xsd -> migration.wsdl
I am using spring boot contract frist approach for generating wsdl from xsd definition. Problem is type are same for both xsd fiels like: credential, so I want to create a common xsd file and include/import in both xsd so can reduce redundant code.
like common.xsd -> entry.xsd, migration.xsd
but getting exception or soap client giving invalid error message.
Any help, how to generate wsdl from two xsd where one is base xsd file?
It's giving, failed to update interface. InvalidFormatException from SOAP Client.
entry.sxd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.test.com/idms-ws"
targetNamespace="http://www.test.com/idms-ws"
elementFormDefault="qualified">
<xs:include schemaLocation="common-element.xsd"></xs:include>
<xs:element name="updateMigrationStatusRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="credential" type="tns:credential" minOccurs="0"/>
<xs:element name="referenceNo" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
common-element.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="credential">
<xs:sequence>
<xs:element name="loginName" type="xs:string" minOccurs="0"/>
<xs:element name="password" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Requirement is read data from file and invoke webservice. Target webservice can handle one payload at a time but there will be multiple payload in source.
So am using while loop to process payload one by one.
Issue: In target service EarningTypeInclusion is optional element, so in source some payload this element will be present and in some payload this option element will not be present.
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
</thresholdRequestInterface>
If am using assign activity, then selection failure fault will come when optional elements are not present in source payload. We are using BPEL 10g, no option in assign activity to supress selection failure fault.
So decided to use transformation inside while loop .
logic used
Read from file
assign Loop counter=1
Count of payload(read from file)
While loop counter<= Count of payload
pass loop counter param value to transform
transform source i.e thresholdRequest[loopcounter] to target
Invoke target web service
increment loop counter
end loop;
Problem is same data is getting trsnformed.
In the below example, referral 11 data is loading 3 times. I have checked conter value, its getting incremented but inside transformation same values are getting transformed.
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>12</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
<thresholdRequest>
<Referral>13</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
</thresholdRequestInterface>
Source
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="thresholdRequestInterface">
<xs:complexType>
<xs:sequence>
<xs:element name="thresholdRequest" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Referral" type="xs:string"/>
<xs:element name="thresholdValue" type="xs:int"/>
<xs:element name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:sequence>
<xs:element name="earningType" type="xs:stirng" />
<xs:element name="ProvisionId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Please find the schema structure for source and target
Target
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="thresholdRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Referral" type="xs:string"/>
<xs:element name="thresholdValue" type="xs:int"/>
<xs:element name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
<xs:complexType>
<xs:sequence>
<xs:element name="earningType" type="xs:stirng" />
<xs:element name="ProvisionId">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Please note schema validation is enabled at target webservice.
Is there a specific reason that you are using Transform.Try using ora:getElement('/thresholdRequestInterface /thresholdRequest',bpws:getVariable(loopCounter))
I have following example xml message:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<to>...</to>
<from>...</from>
<id>..</id>
<relatesTo>...</relatesTo>
<action>...</action>
<version>...</version>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<customComplexElement>
<a>a_v</a>
<b>b_v</b>
<c>c_v</c>
<d>d_v</d>
<e>e_v</e>
<f>f_v</f>
</customComplexElement>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
From which I have generated a xsd file with use of one of online tools:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"></import>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="id" type="xs:string"/>
<xs:element name="relatesTo" type="xs:string"/>
<xs:element name="action" type="xs:string"/>
<xs:element name="version" type="xs:string"/>
<xs:element name="customComplexElement">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="a"/>
<xs:element type="xs:string" name="b"/>
<xs:element type="xs:string" name="c"/>
<xs:element type="xs:string" name="d"/>
<xs:element type="xs:string" name="e"/>
<xs:element type="xs:string" name="f"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Then I generate the appropriate header file with wsdl2h.exe and then compile it with soapcpp2.exe compiler.
Then I try to read xml file with a function soap_read_customComplexElement() and all I get is SOAP_TAG_MISMATCH. This method seems to work if I get rid of all the soap stuff the message but I wonder if there are some functions in gSOAP to parse soap envelope, header and body?
I've had same problem. But i've just fixed it.
So, in my case i use this line of code.
struct soap *soap = soap_new1(SOAP_C_UTFSTRING | SOAP_XML_IGNORENS | SOAP_XML_TREE);
The key paramter is SOAP_XML_IGNORENS. This parameter ignore namespaces.
SOAP_XML_IGNORENS in: ignores the use of XML namespaces in input
The root of this problem is that you don't declare namespaces in your body content. That why gSoap don't know how to convert this xml.
This wouldn't be converted, because gSoap don't know what is ns4:
<ns4:ParseKeywords><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>
But if i declare namespace it will be converted
<ns4:ParseKeywords xmlns:ns4="com.idurdyev.idcommerce:ParseKeywords:1.0"><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>
I have a webservice, and I'm trying to write a client for it. But when I try to add a "Web Service Client" in Netbeans IDE, wsimport utility cannot parse the .wsdl. The reason is "The class serviceCompany is already in use".
I began to analyze the wsdl file, and noticed that there are 2 .xsd files related to the WS.
<types>
<xsd:schema>
<xsd:import namespace="http://services.ws.x.net/" schemaLocation="https://test.x:443/PaymentWS/PaymentWS?xsd=1"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://commonws.ws.x.net/" schemaLocation="https://test.x:443/PaymentWS/PaymentWS?xsd=2"/>
</xsd:schema>
</types>
And I have a complex type named "ServiceCompany" inside of each .xsd files.
inside ?xsd=1:
<xs:complexType name="serviceCompany">
<xs:sequence>
<xs:element name="bankAccount" type="tns:iban"/>
<xs:element name="code" type="tns:companyCode"/>
<xs:element name="description" type="tns:stringMax32"/>
<xs:element name="taxNumber" type="tns:taxNumber"/>
</xs:sequence>
</xs:complexType>
inside ?xsd=2:
<xs:complexType name="serviceCompany">
<xs:sequence>
<xs:element name="code" type="cmn:companyCode"/>
<xs:element name="description" type="cmn:stringMax32"/>
<xs:element name="manualPaymentReceiverCode" type="cmn:companyCode" minOccurs="0"/>
<xs:element name="scCategoryList" type="cmn:stringMax32" maxOccurs="unbounded"/>
<xs:element name="status" type="cmn:objectStatus"/>
<xs:element name="branchList" type="tns:serviceCompanyBranch" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
The namespaces of there .xsd files are different, why wsimport cannot import the wsdl? How can I solve this problem?
Thanks in advance!
Don't close that browser tab!
My issue is xmlbeans I think. I have a small ear with one ejb #WebService that has a xmlbean as a parameter. You will see is uses SOAPBinding.ParameterStyle.BARE as a soapbinding style.
I can see from the stacktrace that it fails at the point it tries to...
createBareMessage()
Is there some way to tell cxf to use a different Factory?
It seems from the error message:
Check for use of a JAX-WS-specific type without the JAX-WS service factory bean
that somehow xmlbeans knows that I'm referencing the class:
PurchaseOrderDocument.class
and that I didn't create it via the Factory class that comes with the generated java code. i.e.
PurchaseOrderDocument.newInstance()
The error it keeps throwing:
14:33:04,566 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-3) Creating Service {http://ws.creigh.com/}PurchaseOrderBeanService from class com.creigh.ws.PurchaseOrderBean
14:33:04,569 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.subunit."purchase-order-EAR.ear"."purchase-order-EJB.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."purchase-order-EAR.ear"."purchase-order-EJB.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "purchase-order-EJB.jar" of deployment "purchase-order-EAR.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.creigh.ws.PurchaseOrderBean method getPurchaseOrder part {http://ws.creigh.com/}document cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean.
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:368)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:67)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:250)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:536)
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:116)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:128)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:67)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
... 5 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.creigh.ws.PurchaseOrderBean method getPurchaseOrder part {http://ws.creigh.com/}document cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean.
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createBareMessage(ReflectionServiceFactoryBean.java:1242)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:488)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:540)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:252)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:453)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:333)
... 13 more
My WebService:
#Stateless
#Local(IPurchaseOrder.class)
#WebService(wsdlLocation="wsdl/PurchaseOrder.wsdl")
#SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.BARE)
//#DataBinding(org.apache.cxf.xmlbeans.XmlBeansDataBinding.class)
public class PurchaseOrderBean implements IPurchaseOrder {
public PurchaseOrderBean() {
}
//This works
#WebMethod(operationName="sayHello")
#WebResult(name="result")
public String sayHello(#WebParam(name="name") String name) {
return "Hello" + name;
}
//This doesn't
#WebMethod(operationName="getPurchaseOrder")
#WebResult(name="order")
public PurchaseOrder getPurchaseOrder(#WebParam(name="document") PurchaseOrderDocument document){
return document.getPurchaseOrder();
}
}
The databinding didn't make any difference because I think I'm mixing up versions of cxf there.
This is my xsd I generated the java from:
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://creigh.com/ee/easypo"
targetNamespace="http://creigh.com/ee/easypo"
elementFormDefault="qualified">
<xs:element name="purchase-order">
<xs:complexType>
<xs:sequence>
<xs:element name="customer" type="po:customer"/>
<xs:element name="date" type="xs:dateTime"/>
<xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="shipper" type="po:shipper" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="customer">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
</xs:sequence>
<xs:attribute name="age" type="xs:int"/>
<xs:attribute name="moo" type="xs:int" default="100"/>
<xs:attribute name="poo" type="xs:int" fixed="200"/>
</xs:complexType>
<xs:complexType name="line-item">
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element name="per-unit-ounces" type="xs:decimal"/>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="quantity" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="shipper">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="per-ounce-rate" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Please yelp!
Regards
I don't believe the version of CXF that JBoss includes in the app server contains the XMLBeans databinding at all. You likely would need to add the appropriate xmlbeans databinding jar (and other jars xmlbeans needs) into JBoss's CXF setup, but I have no idea how to do that. You'd likely have to ask on the JBoss forums.