Any idea about the exception? I cant bind a JAX-WS service due exception thrown:
Exception in thread "main" com.sun.xml.internal.ws.spi.db.DatabindingException: java.lang.IllegalArgumentException: can't parse argument number: ''{0}''
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:90)
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:167)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:203)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:176)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:95)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:309)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:85)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
The project is running in Ecplipse, JDK 1.8.
All artifacts generated by :
/**
* This class was generated by Apache CXF 3.2.0
* 2018-03-28T18:06:56.868+02:00
* Generated source version: 3.2.0
*
*/
#WebService(targetNamespace = "...........", name = "IDocuments")
Classes from wsdl are generated without errors.
Note that with SoapUi I'm able to bind and use this service and couple of other #WebService, generated in the same way, work properly.
Solved...
The problem was a conflict on multiple wsdl generation.
The last generated wsdl deploys its factory classes.
On this way requests and responses was created by the wrong context and the service throws IllegalArgumentException.
Issue fixed by customizing package for each generated wsdl
Related
I'm getting the below exception when the JAXWS Java consumer stub constructor is invoked. When I try via. SOAPUI everything is working fine and able to get correct response. It is a web server to multiple app server (Websphere 7.x clustered) setup. Consumer code looks fine. Provider code is fine, since it works in SOAPUI. There is some problem with Web Server and web server may respond with a HTML rather then XML. App Server doesn't get the request when trying via Java consumer and no logs are there. We tested in local app server without web server setup, it works. Don't know where the problem lies? Anybody can help? I'm using Axis2 that comes with WebSphere for hosting web service. Web Sphere reads annotations in implementation class to deploy web service. Generate WSDL automatically. WSDL Location I've not specified in implementation file, if it specified not works. No configuration file (web.xml, etc.,) i provide. It is not an HTTPS web service. I'm able to telnet to the web service server and get the WSDL via telnet.
javax.xml.ws.WebServiceException: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://ip:port/AppName/ServiceName'.: (http://ip:port/AppName/ServiceName%27.:) org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.util.WSDL4JWrapper.loadDefinition(WSDL4JWrapper.java:754)
at org.apache.axis2.jaxws.util.WSDL4JWrapper.getDefinition(WSDL4JWrapper.java:670)
at org.apache.axis2.jaxws.util.WSDL4JWrapper.commonPartsURLConstructor(WSDL4JWrapper.java:224)
at org.apache.axis2.jaxws.util.WSDL4JWrapper.<init>(WSDL4JWrapper.java:156)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.setupWsdlDefinition(ServiceDescriptionImpl.java:1191)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:245)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.<init>(ServiceDescriptionImpl.java:168)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:142)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:79)
at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:76)
at org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:212)
at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:71)
at javax.xml.ws.Service.<init>(Service.java:67)
at somepackage.servicename.<init>(servicename.java:42)...more are here hidden to maintain confidential
Caused by:
javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://ip:port/AppName/ServiceName'.: (http://ip:port/AppName/ServiceName%27.:) org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2315)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2390)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2356)
at org.apache.axis2.jaxws.util.WSDL4JWrapper$13.run(WSDL4JWrapper.java:745)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132)
at org.apache.axis2.jaxws.util.WSDL4JWrapper.loadDefinition(WSDL4JWrapper.java:742)
... 70 more
Caused by:
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2305)
... 75 more </pre>
I'm not sure what's going wrong with wsdl retrieval for you, but if you can extract the wsdl (and any files it imports) from the remote service and just package them with your client directly, that will avoid retrieving the wsdl from the remote service for each invocation, which besides not working in your case, also degrades performance. Your client wsdllocation would change to file:///(something). If you're using a developer tool like RAD or WDT, it has an option to automatically retrieve the wsdl and package it with the client.
I'm new with the Web services and I have a problem obtaining the java files from a WSDL.
The devs of the servers gave me this information:
I have to generate the source with a xmlbeans binding using Axis2 and Rampart. The requests must be signed with a trusted certificate (I have one) and add a Timestamp.
That said, I downloaded the lastest versions of Axis2 and Rampart and executed the next command line without getting errors:
wsdl2java -d xmlbeans -uri https://juntadeandalucia.e-factura.net/puef/services/SSPPWebServiceProxyService?wsdl -o .\src\
I don't have a clue about how to configure Rampart (just copied the modules in repository/modules, inside Axis2 directory) and I don't know if it varies the result neither. The case is that, following the Apache web examples, I can't use the java source generated as is.
For example, to use the consultarFactura method I would need to write a source like this, following the Apache web examples:
SSPPWebServiceProxyServiceStub webservice = new
SSPPWebServiceProxyServiceStub(url); ConsultarFacturaDocument doc =
ConsultarFacturaDocument.Factory.newInstance();
doc.setNumeroRegistro(numeroRegistro); return
webservice.consultarFactura(doc); //Return the response
But setNumeroRegistro() its not a method of ConsultarFacturaDocument (witch is an interface), its a method of another interface called ConsultarFactura defined inside the first one.
wsdl2java gave me a wrong or incomplete code?
I have to do something more before generating the code?
Can I use another framework to generate a more clean code? (I tried cxf, but wsdl2java gave me errors, using the xmlbeans binding or not).
Any help would be highly appreciated.
(Sorry for my bad english)
I am trying to build a async REST client but getting following error in IBM WebSphere 8.5,
java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder
While building ClientBuilder object. I tried to search everywhere but solution is provided for other application servers not for IBM WebSphere. When I decompiled ClientBuilder class it expect the property JAXRS_DEFAULT_CLIENT_BUILDER = "org.glassfish.jersey.client.JerseyClientBuilder";
but what is the value of implementation class/property for WebSphere?
Code I am trying to run,
ClientBuilder cb = ClientBuilder.newBuilder(); // Exception occurs at this line
Client client = cb.build();
WebTarget target = client.target(URL);
Future<Response> future = target.request(MediaType.APPLICATION_XML).async().
post(Entity.entity(notifications, MediaType.APPLICATION_XML));
Response response = future.get(5, TimeUnit.SECONDS);
if(response.getStatus() == SUCCESS) {
respStatus = SUCCESS;
}
Am I missing some configuration? or property setting?
Note: I have added javax.ws.rs-api-2.0-m10.jar on classpath.
WebSphere provides jaxrs-1.1 implementation based on Wink, so they will conflict with library you provided. You will either need to disable default implementation and use your own, or create Wink client.
Check these posts:
JAX-RS Jersey 2.10 support in Websphere 8
JAX-RS Jersey Client on Websphere 8.5
I want to use cxf and i am trying to generate a client stub from a provided WSDL by maven with cxf-codegen-plugin wsdl2java
Problem is the targetNamespace is named:
http://ip:port/ws/EndpointName.inbound.ws:companyName
and maven generate-sources phase fails with:
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.7.5:wsdl2java (generate-jaxb) on project: Execution generate-jaxb of goal org.apache.cxf:cxf-codegen-plugin:2.7.5:wsdl2java failed: org.apache.cxf.tools.common.ToolException: : is not a valid char in the targetNamespace -> [Help 1]
I believe the endpoint is developed using WebMethods. The company hosting this WS endpoint is telling me they have no control over the targetNamespace.
I tried remplacing
:companyName
by
/companyName
client stub generation goes fine but I get an error when I try to contact their server:
Caused by: javax.ejb.EJBException: javax.xml.ws.WebServiceException: Could not find service named {http://ip:port/ws/EndpointName.inbound.ws/companyName}WebServiceName in wsdl http://ip:port/ws/EndpointName.inbound.ws:companyName?WSDL
Any idea?
Should i switch to axis2 to be compatible with WebMethods?
Thanks a lot
": is not a valid char in the targetNamespace"
resolved by CXF-6527.
You should update your Apache CXF version to a newer version. Issue which has resolved that problem has Fix Version/s of: 3.1.3, 2.7.18, 3.0.7
I think if you add -validate=none to the wsdl2java command, it would bypass that check.
i generated a webservice client in netbeans(jdk1.6) and target client to jdk1.5.03. Then i moved all libs to jdk1.5 classpath and when i run WS Client, i got: java.lang.ExceptionInInitializerErrorCaused by: A WebService annotation is not present on class: java.net.URL i generated it with wsimport.
Any suggestions?
I'm guessng that you probably either need to run JRE 1.6 on your target client, or set the target version to JDK 1.5 in NetBeans.
However, take a look at this link for other potential issues:
http://forum.springsource.org/showthread.php?71220-Consuming-web-services