如何将肥皂标头添加到反应



我在C#中使用SOAP标头:

MeyerWebService.WebServiceEmployees tasnifWS = new MeyerWebService.WebServiceEmployees();
        tasnifWS.UserDetailsValue = new UserDetails()
        {
            userName = "**",
            password = "**"
        };

但我不知道该如何在反应

中做到这一点

您可以使用一个简单的模块与WSSecurity

进行肥皂请求
npm install react-native-soap-request --save

示例

const soapRequest = new SoapRequest({
  security: {
    username: 'username',
    password: 'password'
  },
  targetNamespace: 'http://soap.acme.com/2.0/soap-access-services',
  commonTypes: 'http://soap.acme.com/2.0/soap-common-types',
  requestURL: soapWebserviceURL
});
const xmlRequest = soapRequest.createRequest({
  'soap:ProductRegistrationRequest': {
    attributes: {
      'xmlns:soap': 'http://soap.acme.com/2.0/soap-access-services',
      'xmlns:cmn': 'http://soap.acme.com/2.0/soap-common-types'
    },
    'soap:productId': {
      'cmn:internalId': {
        'cmn:id': productId
      }
    },
    'soap:userId': {
      'cmn:internalId': {
        'cmn:id': userId
      }
    }
  }
});
const response = await soapRequest.sendRequest();

相关内容

  • 没有找到相关文章

最新更新