Ustawienie parametru żądania usługi WWW jako wymaganego pola

Jest to pierwsze podejście do usługi internetowej Jax-WS.

@WebService (serviceName = "MyInstallPhotoService")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public class MyInstallPhotoWS {

    private MyInstallPhotoManager myInstallPhotoManager;

    @Resource
    WebServiceContext context;


    @WebMethod(operationName = "getMyInstallPhoto")
    @WebResult(name = "PhotoRetrievalResponse", partName = "PhotoRetrievalResponse")
    public MyInstallPhotoResponse getBadgePhoto(@WebParam(name = "BadgeNumber", partName = "BadgeNumber") String badgeNumber, @WebParam(name = "LastName", partName = "LastName") String lastName) {
        MyInstallPhotoResponse myInstallPhotoResponse = new MyInstallPhotoResponse();
        try {
            // more code here
        } catch (Exception e) {
          e.printStackTrace();
        }
        return myInstallPhotoResponse;
     }
}

W powyższym kodzie MyInstallPhotoResponse jest zdefiniowany w schemacie XML. Żądanie SoapUI wygenerowało coś takiego

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <rsw:getBadgePhoto>
         <!--Optional:-->
         <rsw:BadgeNumber>I180748-003</rsw:BadgeNumber>
         <!--Optional:-->
         <rsw:LastName>Jones</rsw:LastName>
      </rsw:getBadgePhoto>
   </soapenv:Body>
</soapenv:Envelope>

Jak sprawić, by BadgeNumber i LastName były wymaganym polem, w przeciwieństwie do opcjonalnego, zgodnie z żądaniem soapui. Próbowałem przenieść obiekt badgeNumber i lastName do obiektu myinstallphotorequest (zdefiniowanego w schemacie) i ponownie wymagać dwóch parametrów. Mam prośbę o soapui.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myin="http://www.lexisnexis.com/myInstallPhotoService" xmlns:myin1="http://www.lexisnexis.com/schema/myInstallPhotoServiceTypes">
   <soapenv:Header/>
   <soapenv:Body>
      <myin:getMyInstallPhoto>
         <!--Optional:-->
         <myin:MyInstallPhotoRequest>
            <myin1:badgeNumber>?</myin1:badgeNumber>
            <myin1:lastName>?</myin1:lastName>
         </myin:MyInstallPhotoRequest>
      </myin:getMyInstallPhoto>
   </soapenv:Body>
</soapenv:Envelope>

Ponownie nie mogłem usunąć Opcjonalnego parametru „MyInstallPhotoRequest”.

questionAnswers(1)

yourAnswerToTheQuestion