cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Envelop change namespace

SOAP Envelop change namespace

Hi guys,

I'm trying to write a .net wrapper for magento 2,

at the moment im encountering an issue with the soap request,

i have setup 2 different sites for testing purposes (magento2 & magento2_data)

after i generated the service reference when pointing to 1 of the sites, i could successfully login and get a token

but when i change the endpoint in my app.config file, i run into an error

Message = "Server returned an invalid SOAP Fault.  Please see InnerException for more details."

 

i narrowed it down to the soap envelope namespace which contains the endpoint,

 

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<integrationAdminTokenServiceV1CreateAdminAccessTokenRequest xmlns="http://mylocal:8085/magento2/soap/default?services=integrationAdminTokenServiceV1%2CcustomerCustomerRepositoryV1">
<username xmlns="">some-username</username>
<password xmlns="">some-password</password>
</integrationAdminTokenServiceV1CreateAdminAccessTokenRequest>
</s:Body>
</s:Envelope>

 

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<integrationAdminTokenServiceV1CreateAdminAccessTokenRequest xmlns="http://mylocal:8085/magento2_data/soap/default?services=integrationAdminTokenServiceV1%2CcustomerCustomerRepositoryV1">
<username xmlns="">some-username</username>
<password xmlns="">some-password</password>
</integrationAdminTokenServiceV1CreateAdminAccessTokenRequest>
</s:Body>
</s:Envelope>

is there a setting in magento we could ignore xmlns in the requested object?

 

my code for calling the service is as follows into my function to get the token

            using (Magento2WS.integrationAdminTokenServiceV1PortTypeClient svc = new Magento2WS.integrationAdminTokenServiceV1PortTypeClient())
            {
                var result = svc.integrationAdminTokenServiceV1CreateAdminAccessToken(new Magento2WS.IntegrationAdminTokenServiceV1CreateAdminAccessTokenRequest()
                {
                    username = userName,
                    password = passWord
                });
                retVal = result.result;
            }