2

次のエラーが表示されます: [SaajSoapMessage { http://mycompany/coolservice/specs }ChangePerson]のエンドポイント マッピングが見つかりません

以下は私のws設定ファイルです:

<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
    <description>An endpoint mapping strategy that looks for @Endpoint and @PayloadRoot annotations.</description>
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
    <description>Enables the MessageDispatchServlet to invoke methods requiring OXM marshalling.</description>
    <constructor-arg ref="marshaller"/>
</bean>

<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPaths"> 
    <list>
        <value>org.company.xml.persons</value>
        <value>org.company.xml.person_allextensions</value>
        <value>generated</value>
    </list>
    </property>
</bean>


<bean id="persons" class="com.easy95.springws.wsdl.wsdl11.MultiPrefixWSDL11Definition">   
    <property name="schemaCollection" ref="schemaCollection"/>                                               
    <property name="portTypeName" value="persons"/>                                
    <property name="locationUri" value="/ws/personnelService/"/>                              
    <property name="targetNamespace" value="http://mycompany/coolservice/specs/definitions"/>       
</bean>

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">                   
    <property name="xsds">
    <list>
        <value>/DataContract/Person-AllExtensions.xsd</value>
        <value>/DataContract/Person.xsd</value>
    </list>
    </property>
     <property name="inline" value="true"/>      
</bean>

次に、次のファイルがあります。

public interface MarshallingPersonService {

public final static String NAMESPACE = "http://mycompany/coolservice/specs";
public final static String CHANGE_PERSON = "ChangePerson";

public RespondPersonType changePerson(ChangePersonType request);
}

  @Endpoint
  public class PersonEndPoint implements MarshallingPersonService {

    @PayloadRoot(localPart=CHANGE_PERSON, namespace=NAMESPACE)
    public RespondPersonType changePerson(ChangePersonType request) {
        System.out.println("Received a request, is request null? " + (request == null ? "yes" : "no"));
        return null;        
    }

}

私は WebServices にかなり慣れていないので、注釈にはあまり慣れていません。springws で jaxb マーシャラーをセットアップするためのチュートリアルに従っています。注釈よりも xml マッピングを使用したいのですが、今のところエラー メッセージが表示されます。

編集: ChangePersonType

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ChangePersonType", propOrder = {
"applicationArea",
"dataArea"
})
public class ChangePersonType {

@XmlElement(name = "ApplicationArea", namespace = "http://mycompany/coolservice/specs", required = true)
protected TransApplicationAreaType applicationArea;
@XmlElement(name = "DataArea", namespace = "http://mycompany/coolservice/specs", required = true)
protected DataArea dataArea;
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String releaseID;
@XmlAttribute
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String versionID;

--残りはゲッターとセッターです。

4

1 に答える 1

2

私はそれを解決しました。エンドポイント クラスのパラメーターと戻り変数は、JAXBElement のように JAXBElement でラップする必要がありました。

その理由は

スキーマから JAXB2 によって生成されるクラスには 2 つの種類があります。パラメーターまたは応答として直接使用できる @XmlRootElement アノテーションを持つクラスと、そうでないクラスです。このアノテーションを持たないクラスは、JAXBElement でラップする必要があります。

スキーマから生成されたクラスに加えて、JAXB2 は、JAXBElement の使用を明確にする ObjectFactory クラスも生成します。いくつかのファクトリ メソッドがあり、さまざまなスキーマ タイプの使用方法を示しています。

Arjen Poutsma h ttp://forum.springsource.org/showthread.php?t=49817

于 2010-04-29T14:19:48.973 に答える