title: AXIS 2: Transport error: 404 Error: Not Found - Help Understanding What it Truly Means
body: <p>My group runs an older version of the JBoss Application Server (4.2.3) as our Java application server (please, don't ask why).  JBoss contains a "native" web services stack that we have been using for several years to consume a web service from a vendor.  Unfortunately, the "native" web services stack does not support many of the newer WS-* policies contained in the vendor's latest WSDL for their newest version of their web service.  I tried upgrading the "native" web services stack to the latest version for our JBoss servers (jbossws-native.3.1.1), but that had no effect (unknown policy exceptions).  Further research indicated that in order to support the WS-* policies in the new WSDL, a "newer" web services stack would be needed. I settled on AXIS2 as it has been around for awhile and seems to support the latest WS-* policies (additional research seems to indicate that there may be "better/newer" alternatives to AXIS2 (like Apache CXF), but AXIS2 should work and has decent integration with the Eclipse IDE). BTW... the vendor's web service is a WCF and outside of my control - their product is installed within our company; company employees have access to servers but not to code.</p>
  
  <p>So I created the stub classes from the new WSDL (client generated using AXIS2 Eclipse Code Generator plug-in - running Eclipse Juno) and wrote an "interface method" to invoke the getStreamUrl service.  It appears that the AXIS2 client code is working, as it seems it is actually reaching out to the new web service, but it is failing early in the process with the following error…</p>
  
  <p><code>org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found</code></p>
  
  <p>Based on my research, two things can generate this fault: 1.) The resource actually does not exist (hence the HTTP 404 error), or 2.) The web service does not like the "chunked" Transfer-Encoding HTTP header.  I set an option to disable Transfer-Encoding HTTP header (in the constructor of the stub class; "chunked" = "false") but still receive the same error (I did this as setting this option to "false" seemed to work for some users experiencing the same issue – I also read somewhere that Microsoft web services (WCF) do not like the "chunked" Transfer-Encoding HTTP header (can't remember where I read this)).  </p>
  
  <p>Because the WSDL is over SSL, I "installed" the security certificates from the server serving the WSDL into my local JBoss application server’s keystore and truststore files. I specify this server as the target endpoint passed into the constructor stub class.  I have supplied the client code below (note that it is pretty rough – just want to see if I can get something working). Note that the server hosting the web service/WSDL is in the company network and the WSDL is accessible via a browser.</p>
  
  <p>Below is what is happening before the error (note that it is pretty extensive, as I have enabled TRACE level logging on the axis2 classes to try and see what was happening).  The most pertinent parts are below (this is essentially from the end of the server.log file).  From what I can surmise, the error is occurring because AXIS2 can’t reach this URL: </p>
  
  <p><code>http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl</code></p>
  
  <p>(note this URL is specified within the WSDL and added into the classes generated from that WSDL - it is not reachable from within my company (and fails over to a Page Not Found).</p>
  
  <pre><code>  TRACE [org.apache.axis2.addressing.EndpointReference] hasAnonymousAddress: https://S1002WNS000.naeast.ad.somedomain.com:62201/bsf/service/PlayerFacade?wsdl is Anonymous: false
      TRACE [org.apache.axis2.addressing.EndpointReference] hasNoneAddress: https://S1002WNS000.naeast.ad.somedomain.com:62201/bsf/service/PlayerFacade?wsdl is None: false
      DEBUG [org.apache.axis2.client.Options] getAction (http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl) from org.apache.axis2.client.Options@161091e
      DEBUG [org.apache.axis2.context.MessageContext] SoapAction is (http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl)
      DEBUG [org.apache.axis2.transport.http.CommonsHTTPTransportSender] SOAP Action from messageContext : (http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl)
      TRACE [org.apache.axis2.transport.http.AbstractHTTPSender] Making new ConnectionManager
      TRACE [org.apache.axis2.transport.http.HTTPSender] Thread[http-127.0.0.1-8080-1,5,jboss] PostMethod org.apache.commons.httpclient.methods.PostMethod@d6a9a4 / org.apache.commons.httpclient.HttpClient@11b5077
  [org.apache.axis2.transport.http.SOAPMessageFormatter] contentType from the OMOutputFormat =application/soap+xml
      DEBUG [org.apache.axis2.transport.http.SOAPMessageFormatter] contentType returned =application/soap+xml; charset=UTF-8; action="http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl"
      DEBUG [httpclient.wire.header] &gt;&gt; "POST /bsf/service/PlayerFacade?wsdl HTTP/1.1[\r][\n]"
      DEBUG [org.apache.axis2.transport.http.SOAPMessageFormatter] start getBytes()
      DEBUG [org.apache.axis2.transport.http.SOAPMessageFormatter]   isOptimized=false
      DEBUG [org.apache.axis2.transport.http.SOAPMessageFormatter]   isDoingSWA=false
      DEBUG [org.apache.axis2.transport.http.SOAPMessageFormatter] end getBytes()
      DEBUG [httpclient.wire.header] &gt;&gt; "Content-Type: application/soap+xml; charset=UTF-8; action="http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl"[\r][\n]"
      DEBUG [httpclient.wire.header] &gt;&gt; "User-Agent: Axis2[\r][\n]"
      DEBUG [httpclient.wire.header] &gt;&gt; "Host: S1002WNS000.naeast.ad.somedomain.com:62201[\r][\n]"
      DEBUG [httpclient.wire.header] &gt;&gt; "Content-Length: 414[\r][\n]"
      DEBUG [httpclient.wire.header] &gt;&gt; "[\r][\n]"
      DEBUG [httpclient.wire.content] &gt;&gt; "&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soapenv:Body&gt;&lt;ns3:GetStreamUrlRequest xmlns:ns3="http://nice.com/NICEPerform3/BSF/2007/03/PlayerService"&gt;&lt;ns3:Call&gt;&lt;ns3:CallId&gt;54352434&lt;/ns3:CallId&gt;&lt;ns3:SiteId&gt;1&lt;/ns3:SiteId&gt;&lt;ns3:UserId&gt;0&lt;/ns3:UserId&gt;&lt;/ns3:Call&gt;&lt;ns3:Mode&gt;Segmented&lt;/ns3:Mode&gt;&lt;/ns3:GetStreamUrlRequest&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;"
      DEBUG [httpclient.wire.header] &lt;&lt; "HTTP/1.1 404 Not Found[\r][\n]"
      DEBUG [httpclient.wire.header] &lt;&lt; "HTTP/1.1 404 Not Found[\r][\n]"
      DEBUG [httpclient.wire.header] &lt;&lt; "Content-Length: 0[\r][\n]"
      DEBUG [httpclient.wire.header] &lt;&lt; "Server: Microsoft-HTTPAPI/2.0[\r][\n]"
      DEBUG [httpclient.wire.header] &lt;&lt; "Date: Thu, 22 May 2014 14:39:48 GMT[\r][\n]"
      DEBUG [httpclient.wire.header] &lt;&lt; "[\r][\n]"
      TRACE [org.apache.axis2.transport.http.HTTPSender] Handling response - 404
      DEBUG [org.apache.axis2.i18n.ProjectResourceBundle] getBundle(org.apache.axis2,org.apache.axis2.i18n,resource,null,...)
      DEBUG [org.apache.axis2.i18n.ProjectResourceBundle] loadBundle: Ignoring MissingResourceException: Can't find bundle for base name org.apache.axis2.resource, locale en_US
      DEBUG [org.apache.axis2.i18n.ProjectResourceBundle] Created org.apache.axis2.i18n.resource, linked to parent null
      DEBUG [org.apache.axis2.i18n.ProjectResourceBundle] getBundle(org.apache.axis2,org.apache.axis2.i18n,resource,null,...)
      DEBUG [org.apache.axis2.i18n.ProjectResourceBundle] org.apache.axis2.i18n.resource::handleGetObject(transportError)
      INFO  [org.apache.axis2.transport.http.HTTPSender] Unable to sendViaPost to url[https://S1002WNS000.naeast.ad.somedomain.com:62201/bsf/service/PlayerFacade?wsdl]
  org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
                  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:404)
                  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 com.nice.NiceBSF.PlayerService.PlayerServiceStub.getStreamUrl(PlayerServiceStub.java:4265)
                  at com.NiceBridgeInterface.NiceCallRecordingPlaybackHelper.foobar(NiceCallRecordingPlaybackHelper.java:350)
                  at org.apache.jsp.NiceBridge.NiceBridge_005fExecuteMain_jsp._jspService(NiceBridge_005fExecuteMain_jsp.java:66)
  </code></pre>
  
  <p>Client code to call BSF web service…</p>
  
  <pre><code> //svrInfoBean.getFull_server_path(NiceCallRecordingServerInfo.nice_server_return_fqdn) – contains the full path to the WSDL
      com.nice.NiceBSF.PlayerService.PlayerServiceStub pss = new com.nice.NiceBSF.PlayerService.PlayerServiceStub(svrInfoBean.getFull_server_path(NiceCallRecordingServerInfo.nice_server_return_fqdn));
          com.nice.NiceBSF.PlayerService.Player.CallInfo ci = new com.nice.NiceBSF.PlayerService.Player.CallInfo();
          ci.setCallId(lNiceInteractionId);
          ci.setSiteId(iNiceSiteId);
          com.nice.NiceBSF.PlayerService.Player.GetStreamUrlRequest streamUrlReq = new com.nice.NiceBSF.PlayerService.Player.GetStreamUrlRequest();
          streamUrlReq.setCall(ci);
          streamUrlReq.setMode(com.nice.NiceBSF.PlayerService.Player.CallType.Segmented);
          com.nice.NiceBSF.PlayerService.Player.GetStreamUrlResponse streamUrlRes = pss.getStreamUrl(streamUrlReq);
          String sFileUrl = streamUrlRes.getUrl().toString();
          long lSessionId = streamUrlRes.getSession();
          com.nice.NiceBSF.PlayerService.Player.GetStreamUrlStatusRequest streamUrlStatusReq = new com.nice.NiceBSF.PlayerService.Player.GetStreamUrlStatusRequest();
          streamUrlStatusReq.setSession(lSessionId);
          com.nice.NiceBSF.PlayerService.Player.GetStreamUrlStatusResponse streamUrlStatusRes = pss.getStreamUrlStatus(streamUrlStatusReq);
          String sStreamStatus = streamUrlStatusRes.getStreamUrlStatus().toString();
          while (!sStreamStatus.equalsIgnoreCase(com.nice.NiceBSF.PlayerService.Player.StreamUrlStatus.CallCompleted.toString())) {
                  System.out.println("sStreamStatus = " + sStreamStatus);
                  log.debug("sStreamStatus = " + sStreamStatus);
                  try {
                  Thread.sleep(1000L);
              } catch (InterruptedException e) {
                  log.error("InterruptedException...", e);
              }
                  sStreamStatus = streamUrlStatusRes.getStreamUrlStatus().toString();
          }
          System.out.println("sFileUrl = " + sFileUrl);
          log.debug("sFileUrl = " + sFileUrl);
          System.out.println("sStreamStatus = " + sStreamStatus);
          log.debug("sStreamStatus = " + sStreamStatus);
  </code></pre>
  
  <p>In the "old" web services, I see plenty of references to the vendor's URL’s that really do not resolve to anything, but yet that code works fine. So I am very perplexed by what is happening. So I guess my questions are: Where do I go from here? Am I on the right track thinking that the error I am getting is truly due to that URL not being reachable (seems odd that a company would put company-specific URLs in their WSDL to pages that do not exist)? Should I be using a different web services stack? </p>
  
  <p>Thanks!</p>
  
  <p>P.S. I tried solutions/suggestions at <a href="https://stackoverflow.com/questions/4456342/axis2-always-getting-404-errors">Axis2 - always getting 404 errors</a> and <a href="https://stackoverflow.com/questions/5896480/getting-org-apache-axis2-axisfault-transport-error-404-error-not-found-everyi">Getting org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found everytime</a>; essentially everything that comes up when Googling with the Axis2 error.</p>