cxf调用报错Could not find conduit initiator for address:

阳光穿透心脏的1/2处 2022-12-15 14:21 429阅读 0赞

依赖



org.apache.cxf
cxf-rt-frontend-jaxws
3.2.2

测试代码

@Test

  1. public void test1() \{
  2. JaxWsProxyFactoryBean jaxWs = new JaxWsProxyFactoryBean();
  3. jaxWs.setAddress("http://192.168.8.254:11090/artesia-ux-ws/services/ArtesiaLoginService");
  4. jaxWs.setServiceClass(ArtesiaLoginService.class);
  5. ArtesiaLoginService als = (ArtesiaLoginService) jaxWs.create();
  6. LoginSession login = als.login("tsuper", "Passw0rd!");
  7. System.out.println(login.getId().getIdString());
  8. \}

报错:

Exception in thread “main” javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for address: http://192.168.8.254:11090/artesia-ux-ws/services/ArtesiaLoginService and transport: http://schemas.xmlsoap.org/soap/http

at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
at com.sun.proxy.$Proxy47.login(Unknown Source)
at com.zvn.test.hmc.WebServiceTest.main(WebServiceTest.java:16)
Caused by: java.lang.RuntimeException: Could not find conduit initiator for address: http://192.168.8.254:11090/artesia-ux-ws/services/ArtesiaLoginService and transport: http://schemas.xmlsoap.org/soap/http
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:228)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:233)
at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:146)
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:108)
at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:870)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:528)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:442)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)

… 2 more

接口地址没问题:所以问题是 transport: http://schemas.xmlsoap.org/soap/http

SOAP的传输协议是基于http协议的,需要相关依赖

报错解决方案:

添加依赖:


org.apache.cxf
cxf-rt-transports-http
3.2.2

发表评论

表情:
评论列表 (有 0 条评论,429人围观)

还没有评论,来说两句吧...

相关阅读