Как добавить параметр заголовка в веб-сервисах SOAP в качестве производителя WS в Java - PullRequest
0 голосов
/ 28 октября 2019

Я новичок в веб-сервисе Java. Я хочу добавить заголовки в мой веб-сервис. Я пытался добавить @WebParam (name = "noun", header = true) в мои входные параметры веб-метода. Я попробовал что-то вроде. Мне нужен пример с приведенным ниже форматом вывода XML. Может кто-нибудь, пожалуйста, помогите мне добавить информацию аутентификации в части заголовка.

// Sample XML
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.reports.cfr.nesl.com/">
   <soapenv:Header>
   <AuthenticationInfo>
      <userName>User</userName>
      <password>password<password/>
   </AuthenticationInfo>
</soapenv:Header>
   <soapenv:Body>
      <ser:getCreditFacilReport>
         <arg0>
            <!--Optional:-->
            <info_type>?</info_type>
            <!--Optional:-->
            <info_value>?</info_value>
            <!--Optional:-->
            <output_type>?</output_type>
            <!--Optional:-->
            <requester_pan>?</requester_pan>
         </arg0>
       </ser:getCreditFacilReport>
   </soapenv:Body>
</soapenv:Envelope>

===========The below java code which i have without header param==================


// Service implements calss

@WebService(endpointInterface = "com.nesl.cfr.reports.service.CreditFacilReportService")
public class CreditFacilReportServiceImpl implements CreditFacilReportService 
{

@Override
public CreditFacilReportResponseBean getCreditFacilReport(CreditFacilReportRequestBean requestbean) 
  {
     /*
       ....
       ....
     */


  }

}

//Service class

@WebService
@SOAPBinding(style=SOAPBinding.Style.RPC)
public interface CreditFacilReportService {

    @WebMethod

    public CreditFacilReportResponseBean getCreditFacilReport(CreditFacilReportRequestBean requestbean);


}


...