4

の初心者ですSpring Webservices。を使用して契約優先のWebサービスを作成しようとしていますspring-ws 2.0web.xml(MessageDispatcherServlet)構成、コントラクトデザイン(XSD)、生成されたJAXBクラス、およびサービスの実装を行いました。エンドポイントで混乱しています。次のmvcRESTコントローラーまたはエンポイントのどれが、どのシナリオで使用するのが正しいですか、またその理由は何ですか?前もって感謝します。

@Endpoint
public class PersonEndpoint {

    @Autowired
    private PersonServiceImpl personService;

    @PayloadRoot(localPart = "PersonRequest", namespace = Constants.PERSON_NAMESPACE)
    public @ResponsePayload
    PersonResponseType personReadMethod(@RequestPayload PersonReadRequestType requestElement) {
        return personService.isBiometricNeeded(requestElement);
    }
}

また

@Controller
public class PersonController {

    @Autowired
    private PersonServiceImpl personService;

    @RequestMapping(value = "/person", method = RequestMethod.GET)
    public @ResponseBody
    PersonResponseType personReadMethod(@RequestBody PersonReadRequestType requestElement) {
        return personService.isBiometricNeeded(requestElement);
    }
}
4

1 に答える 1

3

前者はSoap呼び出しに使用され、後者は残りに使用されます(Jacksonも含まれていると思います)

前者で行っているのは、適切な名前空間とlocalPartを使用して着信soap呼び出し時に呼び出されるエンドポイントを宣言することです。あなたの場合、PersonRequest。

簡単な例を説明しているリファレンスガイドの第3章を参照することをお勧めします:http ://static.springsource.org/spring-ws/sites/2.0/reference/html/tutorial.html

後者は、URLへのREST呼び出し用であり、着信パラメーターをPersonReadRequestTypeインスタンスに変換します。

于 2013-02-12T17:09:58.367 に答える