C# 如何将soap头添加到react native?

C# 如何将soap头添加到react native?,c#,react-native,C#,React Native,我在c#中使用soap头,如下所示: 但是我不知道如何在react native中实现这一点,您可以使用一个简单的模块,通过WSSecurity发出SOAP请求 npm install react-native-soap-request --save 范例 const soapRequest = new SoapRequest({ security: { username: 'username', password: 'password' }, targetName

我在c#中使用soap头,如下所示:


但是我不知道如何在react native中实现这一点,您可以使用一个简单的模块,通过WSSecurity发出SOAP请求

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();
你试过使用吗?
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();