1
Camel CXF Componentを使用してコードファーストWebサービスを公開しようとしています。プロジェクトを実行している場合は、Camelを使用したCXF Webサービスの実装
@WebService(serviceName="customerService")
public interface CustomerService
{
public String getCustomerById(String customerId);
}
public class CustomerServiceImpl implements CustomerService
{
@Override
public String getCustomerById(String customerId)
{
System.out.println("Called with "+customerId);
return "Hello " +customerId;
}
}
:私が使用しているSEIおよび実装クラスは些細ある
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<bean id="productServiceImpl" class="com.demo.ws.CustomerServiceImpl" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:productServiceEndpoint" />
<bean ref="productServiceImpl" />
<!-- log input received -->
<to uri="log:output" />
</route>
</camelContext>
<cxf:cxfEndpoint id="productServiceEndpoint"
address="http://localhost:9001/productService" serviceClass="com.demo.ws.CustomerService" />
</beans>
:使用可能な例のいくつかを組み合わせて、私は次のルート定義に来ていますWEBSERVICE実装クラスは、しかしSOAPUIから返されたボディが空で、文字列「こんにちは、[名前]を」返す、正しく呼び出されます。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body/>
</soap:Envelope>
はあなたが私はトンを生産するために助けることができますレスポンスの値を返しますか? あなたが
感謝を。私は文書とリンクを見ました。主な懸案事項は、すべてのメソッドに対してpayloadNameを作成する必要があることです。私はSOAPレスポンスがWebサービス(メッセージの戻り文字列をラップする)から自動的に生成されるかどうか疑問に思っていました。 – user2824073
@ user2824073これはSOAの原則を破るでしょう。生成されたWSDLを最小限の労力で開発者が使用できるように、各メソッドを明確に定義し文書化する必要があります。あなたのコメントに基づいて私の理解から、別の答えを返す1つの方法が欲しいですか?どうか明らかにしてください – Namphibian