We are trying to consume an ASP.NET web service from our CF box and are running into odd issues.
<cfinvoke webservice="http://myserver.mine.com/myservice.asmx?WSDL" method="ImportData" returnvariable="ImportDataCompleted">
<cfinvokeargument name="importJobName" value="job1">
<cfinvokeargument name="force" value="false">
If we run this from a version 9 box, it will work just fine, however, when I run on MX, I get the following error:
Could not perform web service invocation "ImportData" because AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}VersionMismatch faultSubcode: faultString: Possible SOAP version mismatch: Envelope namespace http://www.w3.org/2002/12/soap-envelope was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}VersionMismatch faultSubcode: faultString: Possible SOAP version mismatch: Envelope namespace http://www.w3.org/2002/12/soap-envelope was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. faultActor: faultNode: faultDetail: Possible SOAP version mismatch: Envelope namespace http://www.w3.org/2002/12/soap-envelope was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169) at org.ap...
I have cleared the web services in the administrator, and they do repopulate, but still the error. Any ideas?!
It looks like this is happening because the version of MX you're using is running SOAP 1.1 and ColdFusion 9 is running SOAP 1.2. (Note the text in your error: Possible SOAP version mismatch.)
I'm not familiar with SOAP, but it looks like there are some other differences between the two that you might want to read about. There is a related question that suggests that earlier versions of CF, at least, do not (or did not) support 1.2.
If you are using ColdFusion MX 6.1, you will not be able to consume web services using the cfinvoke tag. The engineers at Adobe/Macromedia didn't include that functionality until CFMX 7.
You will be required to use Java stubs. See this link.
Once you have created the stubs you need to compile them using Java 1.4 (you can use ColdFusion's internal jdk to do so). Then, create a jar file and deploy it to you instance of ColdFusion, normally ./runtime/lib/. Restart ColdFusion and create an object using CFObject. Then call the web service's methods using the Java object your just created.
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 have 2 WSO2 Enterprise Integrator behind a load balancer.
I want to activate the tomcat http session replication, and followed the WSO2 documentation.
It seems quite simple :
Add
<Cluster className="org.wso2.carbon.core.session.CarbonTomcatSimpleTcpCluster"/>
and
<Valve className="org.wso2.carbon.webapp.mgt.session.CarbonTomcatSessionReplicationValve"/>
in catalina-server.xml, and make application distributable by adding <distributable/>
in web.xml.
Badly, it seems that WSO2 add some non serializable attributes to the session, making the replication fail.
When I try to connect to the carbon application, I get the following exception :
ERROR - ApplicationDispatcher Servlet.service() for servlet bridgeservlet threw exception java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute CarbonAuthenticator
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1453)
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1413)
at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:149)
at org.eclipse.equinox.http.servlet.internal.HttpSessionAdaptor.setAttribute(HttpSessionAdaptor.java:96)
at org.wso2.carbon.ui.tracker.AuthenticatorRegistry.getCarbonAuthenticator(AuthenticatorRegistry.java:82)
at org.wso2.carbon.ui.CarbonUILoginUtil.getAuthenticator(CarbonUILoginUtil.java:69)
at org.wso2.carbon.ui.CarbonSecuredHttpContext.handleSecurity(CarbonSecuredHttpContext.java:76)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
Precision : I tried with a fresh WSO2EI 6.1.1 installation, doing only the previously described modifications.
I also had to manually add tomcat-juli-7.0.75.jar and tomcat-trives-7.0.75.jar on wso2/lib/endorsed to avoid ClassNotFoundException.
I checked the WSO2 source code, and saw that the CarbonAuthenticator class is effectively non serializable.
Does anyone already configured the http session replication successfully ?
Thanks in advance,
Regards,
Laurent
I am trying to consume a web service using the URL they gave me. When running the page I am getting the following error:
Cannot perform web service invocation RegistraFacturaXML.
The fault returned when invoking the web service operation is:
org.apache.axis2.AxisFault: Transport error: 302 Error: Redirect
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:402)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at gt.com.megaprint.www.webservice.SSO_wsEFacturaStub.registraFacturaXML(SSO_wsEFacturaStub.java:8431)
at sun.reflect.NativeMethodAccessorImpl.inv... ''
I have checked that port 443 is open and I installed the certificate that I was sent. I called the web service using SoapUI and it works for me. I do not know what to do now?
this is my code:
`<cfsavecontent variable="strdata">
<FACTURA>
<ENCABEZADO>
<NOFACTURA>1026</NOFACTURA>
<RESOLUCION>2016-50-51-35</RESOLUCION>
<IDSERIE>TBCF</IDSERIE>
<EMPRESA>883</EMPRESA>
<SUCURSAL>1</SUCURSAL>
<CAJA>001</CAJA>
<USUARIO>JCRUZ</USUARIO>
<MONEDA>GTQ</MONEDA>
<TASACAMBIO>1</TASACAMBIO>
<GENERACION>O</GENERACION>
<FECHAEMISION>20/12/2016</FECHAEMISION>
<NOMBRECONTRIBUYENTE>TRANSPORTES ESTRATEGICOS,S.A.</NOMBRECONTRIBUYENTE>
<DIRECCIONCONTRIBUYENTE>20 AVENIDA 7-95 ZONA 14 GUATEMALA</DIRECCIONCONTRIBUYENTE>
<NITCONTRIBUYENTE>5559845-5</NITCONTRIBUYENTE>
<VALORNETO>8869.68</VALORNETO>
<IVA>1064.36</IVA>
<TOTAL>9934.04</TOTAL>
<DESCUENTO>0.00</DESCUENTO>
<EXENTO>0.00</EXENTO>
</ENCABEZADO>
<OPCIONAL>
<TOTAL_LETRAS>NUEVE MIL NOVECIENTOS TREINTA Y CUATRO QUETZALES 04/100 ***********************</TOTAL_LETRAS>
</OPCIONAL>
<DETALLE>
<LINEA>
<CANTIDAD>8</CANTIDAD>
<DESCRIPCION>11R22.5 16PR LLD37 TRACCION</DESCRIPCION>
<METRICA>PC</METRICA>
<PRECIOUNITARIO>1241.76</PRECIOUNITARIO>
<VALOR>9934.04</VALOR>
</LINEA>
</DETALLE>
</FACTURA>
</cfsavecontent>
<cfinvoke webservice="https://www.ifacere.com/lineapruebas/sso_wsefactura.asmx?wsdl" method="RegistraFacturaXML" returnvariable="RegistraFacturaXMLResult" wsversion="2">
<cfinvokeargument name="pXmlFactura" value="<![CDATA[#strData#]]>"/>
</cfinvoke>
<cfoutput>#RegistraFacturaXMLResult#</cfoutput>
`
I called the web service using SoapUI and it works for me.
I remember a similar situation that I had encountered. The reason I had issues was because the web service was expecting complex types i.e. the web service had minoccurs and maxoccurs defined.
The solution I ended up with was to use the SoapUI response that worked and save that as my Soap request. Then use the CFHTTP tag. See the post below that helped me write my own SOAP solution. Neither CF 11, nor any version that I am aware of, handles the minoccurs or maxoccurs complex types web service.
Making SOAP Web Service Requests With ColdFusion
I have a JAX-WS #WebServiceProvider and would like to support both SOAP 1.1 and 1.2 protocols. I handle creation of response SOAPMessage of proper version manually. I have WSDL describing bindings for both, 1.1 and 1.2 protocol.
But the service endpoint is only able to support either version at a time.
I would appreciate either a solution or a pointer to a piece of doc where it's stated that it's impossible.
P.S. i'm using WebSphere 7 app server, which is bundled with JAX-WS 2.0 (which is Axis2 based)
I experienced the same problem. The main issue for me is that it is not possible to compile the class with both #BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) and #BindingType(value = SOAPBinding.SOAP11HTTP_BINDING). Have a look to this http://www-01.ibm.com/support/docview.wss?uid=swg1PK96819, and this http://www-01.ibm.com/support/docview.wss?uid=swg1PK83482, it should be possible to set #BindingType(SOAPBinding.SOAP_HTTP_BINDING) to have the both SOAP version to be delivered. Unfortunaltely, i did not compile also with the Websphere runtime environment, what i don't understand.
I recently dealt with a service deployment issue related to trying to simultaneously enable both SOAP 1.1 and 1.2 for a service (on WebSphere v7.0). Unfortunately, I don't think that your question gives enough information to provide a specific solution.
It IS possible to support both bindings at the same time, but there are some considerations. I think the main thing is that the server has to be able to listen on separate endpoints (URLs) for each binding. As near as I can tell, this requires appropriate entries in your web.xml and/or your webservices.xml configuraiton files.
For an annotation based service, these configuration entries are theoretically optional; but when you try to enable multiple bindings for a given service without the "optional" configuration entries, the WAS Axis2 extension fails with various possible exceptions.
If you could provide more detail about your wsdl, and the relevant portions of web.xml and webservices.xml (if any), as well as any error messages reported in the WAS log(s) during deployment and application startup, then I could probably give a better answer.
In making a CF web-service call it was necessary to create a SOAP header. In CF9 we were able to use the setHeader() method. This works on my production server (running CF9). However, I've upgraded my local system to CF10 (for dev purposes) and discovered this method no longer works. It throws the following error:
Web service operation setHeader with parameters {...} cannot be found.
When I dump the object, I see that org.apache.axis2.client.Stub is used instead of org.apache.axis.client.Stub. So my question is two fold:
Where is the setHeader method in Axis2 ?
If that method is no longer accessible, how do I specify for my object call to use Axis1.x NOT Axis2 ?
I hope this makes sense.
How do I specify for my object call to use Axis1.x NOT Axis2
You can always switch back to Axis1, as described here and here. In summary:
...ColdFusion 10 allows you to specify the version of Axis in which
WebServices should be published or consumed. [It] has given a control
at three levels:
Server level
New setting named wsversion in the CF WebServices Administration screen
Application level (via the Application.cfc)
this.wssettings.version.publish = 1
this.wssettings.version.consume = 1
Component level
For publishing <cfcomponent wsversion="1">
For consuming createObject("webservice", theURL, {wsversion="1"})