calling a soap service from C#

Aamir

I have working PHP code which calls a SOAP service and it works. Its as follows:

<?php
try
{
    $client = new SoapClient(null, array(
        'location' => "http://108-168-196-91.mycitrixdemo.net/zdm/services/EveryWanDevice?wsdl",
        'uri' => "http://zdemo2.zenprise.com",
        'login' => "Admin",
        'password'=> "XXXXX"));

    $properties=$client->getDeviceProperties("XXXXXXXX",null);

    for($i=0;$i<count($properties);$i++) {
        printf ("name: %s, value: %s\n" , $properties[$i]->name, $properties[$i]->value);
    }
}
catch (Exception $e)
{
    print_r($e); exit;
}
?>

I need to access the same service from C#. I have tried adding Service Reference to http://108-168-196-91.mycitrixdemo.net/zdm/services/EveryWanDevice?wsdl and this added the following section in my app.config.

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="EveryWanDeviceSoapBinding" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://108-168-196-91.mycitrixdemo.net/zdm/services/EveryWanDevice"
            binding="basicHttpBinding" bindingConfiguration="EveryWanDeviceSoapBinding"
            contract="ServiceReference1.DeviceService" name="EveryWanDevice" />
    </client>
</system.serviceModel>

I am now provided with the proxy classes but I dont know how to set them up so I could call this service.

I am doing it as follows in C#:

DeviceService srv = new DeviceServiceClient();//
srv.authenticateUser(new authenticateUserRequest("Admin", "XXXXXX"));

var devices = srv.getDeviceProperties(new getDevicePropertiesRequest("99000067296308", null));

But the srv.authenticateUser line throws the following exception:

RPC Message getDeploymentHistoRequest1 in operation getDeploymentHisto1 has an invalid body name getDeploymentHisto. It must be getDeploymentHisto1

I have no idea what does this error mean. Can anybody help?

Mitch

This is due to using a WCF reference versus a standard service reference.

Take a look at WCF: Svcutil generates invalid client proxy, Apache AXIS Web Service, overload operations for further discussion.

In short, use Add Web Reference on the Advanced page of Add Service Reference:

Add Web Reference

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Problems calling Magento SOAP V2 Service in C#

From Dev

Problems calling Magento SOAP V2 Service in C#

From Dev

Calling a web service SOAP in java

From Dev

Calling a SOAP service using REST service

From Dev

Calling a SOAP service using REST service

From Dev

Calling a C# SOAP webservice from PHP generates bad data

From Dev

Calling C# Web Service from JQuery

From Dev

SOAP API wsdl Service calling using perl

From Dev

SOAP API wsdl Service calling using perl

From Dev

Calling a SOAP service with Python & zato.io

From Dev

Manually calling a web service with a SOAP message

From Dev

Calling W3C's Validator SOAP Service Using Java

From Dev

Calling Javascript from service android

From Dev

Calling a Rest Service from a servlet

From Dev

Calling an EXE from a WCF Service

From Dev

Getting null value in the response from a soap service

From Dev

How can I pass a DateTime object to a Soap web service written with C# from PHP?

From Dev

C# soap web service and Java client

From Dev

Soap service method class definition c#

From Dev

Calling Swift from C

From Dev

calling system() from c

From Dev

Calling a soap webservice from java with nonce in security headers

From Dev

Not able to get SOAP response after calling external webservice from java

From Dev

PHP: Error calling SOAP rpc webservice from Java - Worked before

From Dev

Getting Error When Calling Magento SOAP API in Objective-C

From Dev

Calling C# asp.net web service or web method from email without opening browser

From Dev

Calling C# asp.net web service or web method from email without opening browser

From Dev

Calling another controller from service class in spring

From Dev

Calling WCF Service from JQuery does not work

Related Related

  1. 1

    Problems calling Magento SOAP V2 Service in C#

  2. 2

    Problems calling Magento SOAP V2 Service in C#

  3. 3

    Calling a web service SOAP in java

  4. 4

    Calling a SOAP service using REST service

  5. 5

    Calling a SOAP service using REST service

  6. 6

    Calling a C# SOAP webservice from PHP generates bad data

  7. 7

    Calling C# Web Service from JQuery

  8. 8

    SOAP API wsdl Service calling using perl

  9. 9

    SOAP API wsdl Service calling using perl

  10. 10

    Calling a SOAP service with Python & zato.io

  11. 11

    Manually calling a web service with a SOAP message

  12. 12

    Calling W3C's Validator SOAP Service Using Java

  13. 13

    Calling Javascript from service android

  14. 14

    Calling a Rest Service from a servlet

  15. 15

    Calling an EXE from a WCF Service

  16. 16

    Getting null value in the response from a soap service

  17. 17

    How can I pass a DateTime object to a Soap web service written with C# from PHP?

  18. 18

    C# soap web service and Java client

  19. 19

    Soap service method class definition c#

  20. 20

    Calling Swift from C

  21. 21

    calling system() from c

  22. 22

    Calling a soap webservice from java with nonce in security headers

  23. 23

    Not able to get SOAP response after calling external webservice from java

  24. 24

    PHP: Error calling SOAP rpc webservice from Java - Worked before

  25. 25

    Getting Error When Calling Magento SOAP API in Objective-C

  26. 26

    Calling C# asp.net web service or web method from email without opening browser

  27. 27

    Calling C# asp.net web service or web method from email without opening browser

  28. 28

    Calling another controller from service class in spring

  29. 29

    Calling WCF Service from JQuery does not work

HotTag

Archive