AXIS 2:传输错误:404错误:未找到 - 帮助理解它的真正含义

时间:2014-05-23 01:18:25

标签: java web-services soap wsdl axis2

我的小组运行旧版本的JBoss Application Server(4.2.3)作为我们的Java应用程序服务器(请不要问为什么)。 JBoss包含一个" native"我们多年来一直使用的Web服务堆栈,用于从供应商处获取Web服务。不幸的是," native" Web服务堆栈不支持供应商最新版本的Web服务中包含的许多较新的WS- *策略。我尝试升级" native" Web服务堆栈到我们的JBoss服务器的最新版本(jbossws-native.3.1.1),但是没有效果(未知的策略异常)。进一步的研究表明,为了在新的WSDL中支持WS- *策略,一个新的"更新的"将需要Web服务堆栈。我决定使用AXIS2,因为它已经存在了一段时间并且似乎支持最新的WS- *策略(其他研究似乎表明可能有更好/更新的" AXIS2的替代品(如Apache CXF),但是AXIS2应该可以工作并与Eclipse IDE集成。 BTW ......供应商的网络服务是一个WCF,不受我控制 - 他们的产品安装在我们公司内部;公司员工可以访问服务器,但不能访问代码。

所以我从新的WSDL(使用AXIS2 Eclipse Code Generator插件生成的客户端 - 运行Eclipse Juno)创建了存根类,并编写了一个"接口方法"调用getStreamUrl服务。似乎AXIS2客户端代码正在工作,因为它似乎实际上正在接触新的Web服务,但它在过程的早期失败,出现以下错误......

org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found

根据我的研究,有两件事可以产生这个错误:1。)资源实际上不存在(因此HTTP 404错误),或2.)Web服务不喜欢" chunked&#34 ;传输编码HTTP标头。我设置了一个选项来禁用Transfer-Encoding HTTP标头(在存根类的构造函数中;" chunked" =" false")但仍然收到相同的错误(我这样做是设置这个" false"的选项似乎适用于遇到同样问题的一些用户 - 我还读过微软网络服务(WCF)不喜欢" chunked" Transfer-Encoding HTTP头的地方(不记得我在哪里读到这个))。

因为WSDL是通过SSL的,所以我安装了"从服务WSDL的服务器到我的本地JBoss应用程序服务器的密钥库和信任库文件的安全证书。我将此服务器指定为传递给构造函数存根类的目标端点。我已经提供了下面的客户端代码(注意它非常粗糙 - 只是想看看我能不能正常工作)。请注意,托管Web服务/ WSDL的服务器位于公司网络中,并且可以通过浏览器访问WSDL。

下面是错误发生之前发生的事情(注意它非常广泛,因为我已经在axis2类上启用了TRACE级别日志记录来尝试查看发生了什么)。最相关的部分如下(这主要来自server.log文件的末尾)。据我所知,错误正在发生,因为AXIS2无法访问此URL:

http://nice.com/NICEPerform3/BSF/2007/03/PlayerService/PlayerServiceContract/GetStreamUrl

(请注意,此URL在WSDL中指定并添加到从该WSDL生成的类中 - 无法从我公司内部访问(并故障转移到找不到页面)。

  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] >> "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] >> "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] >> "User-Agent: Axis2[\r][\n]"
    DEBUG [httpclient.wire.header] >> "Host: S1002WNS000.naeast.ad.somedomain.com:62201[\r][\n]"
    DEBUG [httpclient.wire.header] >> "Content-Length: 414[\r][\n]"
    DEBUG [httpclient.wire.header] >> "[\r][\n]"
    DEBUG [httpclient.wire.content] >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns3:GetStreamUrlRequest xmlns:ns3="http://nice.com/NICEPerform3/BSF/2007/03/PlayerService"><ns3:Call><ns3:CallId>54352434</ns3:CallId><ns3:SiteId>1</ns3:SiteId><ns3:UserId>0</ns3:UserId></ns3:Call><ns3:Mode>Segmented</ns3:Mode></ns3:GetStreamUrlRequest></soapenv:Body></soapenv:Envelope>"
    DEBUG [httpclient.wire.header] << "HTTP/1.1 404 Not Found[\r][\n]"
    DEBUG [httpclient.wire.header] << "HTTP/1.1 404 Not Found[\r][\n]"
    DEBUG [httpclient.wire.header] << "Content-Length: 0[\r][\n]"
    DEBUG [httpclient.wire.header] << "Server: Microsoft-HTTPAPI/2.0[\r][\n]"
    DEBUG [httpclient.wire.header] << "Date: Thu, 22 May 2014 14:39:48 GMT[\r][\n]"
    DEBUG [httpclient.wire.header] << "[\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)

调用BSF网络服务的客户端代码......

 //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);

在&#34; old&#34;网络服务,我看到很多参考供应商的网址确实无法解决任何问题,但该代码工作正常。所以我对发生的事情感到非常困惑。所以我想我的问题是:我从哪里开始?我是否在正确的轨道上认为我得到的错误确实是由于该URL无法访问(公司会将公司特定的URL放在他们的WSDL中而不是存在的页面,这似乎很奇怪)?我应该使用不同的Web服务堆栈吗?

谢谢!

P.S。我在Axis2 - always getting 404 errorsGetting org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found everytime尝试了解决方案/建议;基本上是在使用Axis2错误进行Google搜索时出现的所有内容。

0 个答案:

没有答案
相关问题