1

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>

`

Daniel Mtz
  • 21
  • 2
  • 1
    Your service call is apparently receiving a [302 HTTP response](http://stackoverflow.com/questions/973098/what-does-http-1-1-302-mean-exactly) which means it is telling you to request some other page. It might be a login page or something else. What happens if you simply open the browser on your ColdFusion server and navigate to that same URL? It would also help if you could post the code where you are attempting to make this call. Then we may be able to help further. – Miguel-F Jan 17 '17 at 12:58
  • Hello I put my code, I really do not know if it's right, it's my first time creating web services. – Daniel Mtz Jan 17 '17 at 17:09
  • The code looks okay. Are you sure that the ColdFusion server can access that website `https://www.ifacere.com/`? If it is sitting behind a proxy server you may need to provide user credentials to reach the internet (which could be the source of that 302 redirect to a login form). This is why I asked you to open the browser on the ColdFusion server and try to go to the URL to see if that works or if you get some prompt. – Miguel-F Jan 17 '17 at 18:05

1 Answers1

2

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

Community
  • 1
  • 1
ah7866
  • 136
  • 3
  • I will second this answer. I've had to do this several times in CF because either the CF version couldn't handle axis2 services or there were complex types. Thankfully, most of my web service calls are now to REST services which are much easier to deal with. – Sam M Jan 18 '17 at 16:18