2013-02-05 14 views
13

Sorun açıklaması uzun olabilir. Web servislerine yeni başladığımdan lütfen sabırlı olun ve her türlü yardımı yapın.Web hizmetinden yanıt veren Apache CXF, "Bağlantılı işlem bilgisi yok" ifadesini gösterir.

Ne yaptım: Apache CXF RI kullanarak java'da bir web hizmeti oluşturdum. Sadece bir sınıf oluşturdum ve SEI, WSDL ve XML dosyalarını oluşturmak için aşağıdan yukarıya geliştirme yaklaşımını kullandım.

sorundur Ne: bilinmeyen parametreleri içeren bilinmeyen yöntemi çağrılırken ederken Şimdi, "http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort/whatIsTheAnswer" isteyemiyorsanız, olarak hiçbir bağlayıcı işlem bilgisi çıktı üretir. aşağıdaki gibi yanıttır:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <soap:Fault> 
     <faultcode>soap:Server</faultcode> 
     <faultstring>No binding operation info while invoking unknown 
     method with params unknown.</faultstring> 
    </soap:Fault> 
    </soap:Body> 
</soap:Envelope> 

oluşturulan WSDL olup:

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:tns="http://ws.service.com/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
name="DeepThoughtService" targetNamespace="http://ws.service.com/"> 
    <wsdl:types> 
    <schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:tns="http://ws.service.com/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns="http://www.w3.org/2001/XMLSchema"> 
     <import namespace="http://ws.service.com/" 
     schemaLocation="http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort?xsd=deepthought_schema1.xsd" /> 
    </schema> 
    </wsdl:types> 
    <wsdl:message name="whatIsTheAnswerResponse"> 
    <wsdl:part element="tns:whatIsTheAnswerResponse" 
    name="parameters"></wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="whatIsTheAnswer"> 
    <wsdl:part element="tns:whatIsTheAnswer" name="parameters"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:portType name="DeepThought"> 
    <wsdl:operation name="whatIsTheAnswer"> 
     <wsdl:input message="tns:whatIsTheAnswer" 
     name="whatIsTheAnswer"></wsdl:input> 
     <wsdl:output message="tns:whatIsTheAnswerResponse" 
     name="whatIsTheAnswerResponse"></wsdl:output> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="DeepThoughtServiceSoapBinding" 
    type="tns:DeepThought"> 
    <soap:binding style="document" 
    transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="whatIsTheAnswer"> 
     <soap:operation soapAction="" style="document" /> 
     <wsdl:input name="whatIsTheAnswer"> 
     <soap:body use="literal" /> 
     </wsdl:input> 
     <wsdl:output name="whatIsTheAnswerResponse"> 
     <soap:body use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="DeepThoughtService"> 
    <wsdl:port binding="tns:DeepThoughtServiceSoapBinding" 
    name="DeepThoughtPort"> 
     <soap:address location="http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort" /> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

DeepThought sınıfı içerir:

@WebService(targetNamespace = "http://ws.service.com/", portName = "DeepThoughtPort", serviceName = "DeepThoughtService") 
public class DeepThought { 
    public String whatIsTheAnswer(@WebParam(name = "arg0") String interviewer) { 
     return ("The answer " + interviewer); 
    } 
} 

talep zamanda çıkış konsolu bazılarını göstermektedir Hatalar:

Gelen sabun yöntemi doğru WSDL eşleşmeyen Genel olarak
Feb 05, 2013 3:59:14 PM org.apache.cxf.service.invoker.AbstractInvoker invoke 
SEVERE: Invocation without a binding operation. 
Feb 05, 2013 3:59:14 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging 
WARNING: Interceptor for {http://ws.service.com/}DeepThoughtService has thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault: No binding operation info while invoking unknown method with params unknown. 
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:59) 
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) 
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) 
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) 
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218) 
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:163) 
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137) 
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 

Feb 05, 2013 3:59:14 PM org.apache.cxf.services.DeepThoughtService.DeepThoughtPort.DeepThought 
INFO: Outbound Message 
--------------------------- 
ID: 5 
Response-Code: 500 
Encoding: UTF-8 
Content-Type: text/xml 
Headers: {} 
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>No binding operation info while invoking unknown method with params unknown.</faultstring></soap:Fault></soap:Body></soap:Envelope> 

cevap

7

, bu durum genellikle oluşur. Böyle bir durumda, sabun mesajı serviste uygun bir yöntemle eşlenemedi. CXF sadece ne yapacağını bilmiyor. Gelen sabun mesajını iki kez kontrol edin.

Source of the above explanation.

Olası çözüm:

@WebService(targetNamespace = "http://ws.service.com/", 
     portName = "DeepThoughtPort", 
     serviceName = "DeepThoughtService", 
     endpointInterface = "your.pck.DeepThoughtService", 
     wsdlLocation = "WEB-INF/wsdl/DeepThoughtService.wsdl") 
public class DeepThought { 

    @WebMethod(action = "whatIsTheAnswer") 
    public String whatIsTheAnswer(@WebParam(name = "arg0") String interviewer) { 
     return ("The answer " + interviewer); 
    } 
} 

Ne yapacağını senin @WebService yılında WSDL konumu ve endpointInterface eklemektir. Ayrıca, Java-First yaklaşımını kullanıyorsunuz, böylece yönteminizin @WebMethod(action = "whatIsTheAnswer") ile açıklanması gerekir. yöntem CXF açıklamalı değildir Yani eğer web hizmeti hiç bir yöntemlerini içermediğini "anlar" ve der ki: Ayrıca No binding operation info while invoking unknown method with params unknown.

Bkz: Ben

+0

WSDL konumunu sağladım, endpointInterface ve ayrıca @WebMethod (action = "whatIsTheAnswer"). Hala cevap yok. İsteğim doğru mu "http: // localhost: 8084/DeepThoughtWS/hizmetler/DeepThoughtPort/whatIsTheAnswer"? – Sujan

+0

İsteğiniz ne demek istiyorsun? Bu URL, istek değil. Bu, dağıtılan web hizmetinizin bitiş noktasıysa, SOAP isteğini ona gönderdiniz. –

+0

URL'yi kastettim. URL'den yanıt alabilir miyim? SOAP isteği gönderirseniz web servisi çalışıyor. Ama URL'den GET kullanarak XML çıktısı almak için herhangi bir yolu var mı? – Sujan

2

Aynı problem. Cxf 2.6 2.7 Kullanma Bu istek chrome veya firefox gibi bir web tarayıcısıyla çalışmadı. Cxf'de bir müşteriyi kullanmayı denedim ve işe yarıyor! Web hizmetleriniz çalışıyor ancak bir web tarayıcısı tarafından istekte bulunamıyorsunuz, çünkü bir uçbirim, XML'in gereksinimlerini bildiğinden beri bir müşteriye ihtiyacınız var.

1

Evet, bir tarayıcı URL'sindeki hizmete doğrudan erişemiyorsunuz.Bu

import org.apache.cxf.interceptor.LoggingInInterceptor; 
import org.apache.cxf.interceptor.LoggingOutInterceptor; 
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; 
import org.junit.Test; 


@Test 
public void testWhatIsTheAnswer() { 

    JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); 

    factoryBean.getInInterceptors().add(new LoggingInInterceptor()); 
    factoryBean.getOutInterceptors().add(new LoggingOutInterceptor()); 
    factoryBean.setServiceClass(DeepThought.class); 
    factoryBean.setAddress("http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort"); 

    DeepThought service = (DeepThought) factoryBean.create(); 

    service.whatIsTheAnswer("some answer"); 

} 
0

Birisi SOAP WebService ile GET isteği çağırır fakat SOAP WebServicesGET isteği alamaz gibi bir istemci kodu gerekir. Ona SOAP WebService numaralı telefonumu GET isteğiyle aramamalı ya da described here gibi GET isteğimle web servisimi aramalısınız.

İlgili konular