Timed Out from web service

liatliat liat USMember
edited June 2013 in Android

Hi,
when I'm trying to call the web service I'm getting TimedOut.
But when I'm doing it from class Library project (a simple project) it works just fine.
what can I do?
Thanks.

Posts

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    Can you provide a bit more information on what you are doing?

  • liatliat liat USMember

    yes.
    I added web Service Reference - written by WCF,soap protocol
    to android class Library .

    Code:

    Employees.Core.EmployeeServiceReference.UserManagementService userManagementService = new Employees.Core.EmployeeServiceReference.UserManagementService();
    userManagementService.Credentials = new System.Net.NetworkCredential(userName, password, domain);

    return userManagementService.GetEmployee (id,true);

    GetEmployee reference:

        public Employee GetEmployee(int empId, [System.Xml.Serialization.XmlIgnoreAttribute()] bool empIdSpecified) {
    object[] results = this.Invoke("GetEmployee", new object[] {
    empId,
    empIdSpecified});
    return ((Employee)(results[0]));

    it returns null, every service there returns null.

    I get data when I use winForms... (or a simple class library -C# )- I use xamarin Plugin for VS 2012.
    another thing how can I implement it by cross Platform without adding the webService to every project like :
    Ios,android class library ect...
    thanks.

  • WilleWille Wille DontGotOne DEMember
    edited June 2013

    Hi,

    Is the Employee-object null? Or just the objects attribute.

    I had some "fun" playing with Soap-Webservices, too. I used the .Net-version. And I wanted to get a more or less complex object with a request.
    I created a Webreference, too, my "complex" objects were received correctly (not null). But all attributes were null. Don´t even know, where the problem is, since the proxie generated the Class and its objects:-/ Since simple types were received Xamarin without problems I changed my Webservice and converted my objects into JSON before transmitting them to/from the Service.
    That worked, but it´s only a workaround.

    To your last point:
    I also got to the point to share a Web Refence among projects. I simply created new folder "Web Reference" with a subfolder "yourReference" in each Project. Last I referenced the 3 files from my Core-Project, that are located in "Web Reference/yourReference"
    I don't know, if this is correct, but I think this works.

    Greetings,
    Wille

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    Please ensure that you are following this guide when connecting to WCF services, do not simply reuse proxy code from a regular .Net project.

    In particular, you should use SLsvcUtil.exe to generate your proxy.

  • liatliat liat USMember

    Ok,
    I have a few qes.
    1)XmlDictionaryReaderQuotas is not recognize (I have the dll)
    2) client = new Service1Client(binding, new EndpointAddress ("http://192.168.1.100/Service1.svc"));

    what is client and Service1Client?
    Thanks

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    Not sure what you mean. Can you attach your project (or a reduced version of it)?

  • liatliat liat USMember
    edited June 2013

    I looked at the Guide you sent.
    but as I saw the guid is for Xamarin.iOS projects. and I'm trying to do it for android.
    is it the same?
    can you give me an example project?

  • liatliat liat USMember

    Hi,
    The wsdl I send is:

    <soap:Envelope
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    >
    <soap:Body>
    <GetEmployee
    xmlns="http://local/services"
    >
    <empId>1111</empId>
    <empIdSpecified>true</empIdSpecified>
    </GetEmployee>
    </soap:Body>
    </soap:Envelope>

    The Only problem with that is the attribute ,it should be without it:

    <empIdSpecified>true</empIdSpecified>

    when the reference is: Look at the XmlIgnoreAttribute().

      public Employee GetEmployee(int empId, [System.Xml.Serialization.XmlIgnoreAttribute()] bool empIdSpecified) {
    object[] results = this.Invoke("GetEmployee", new object[] {
    empId,
    empIdSpecified});
    return ((Employee)(results[0]));
    }

    I'm consuming it like a SOAP Services

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    The guide mentions iOS, but the process should be the same for Android.

    On a sidenote, if you have control over the service itself and are in the design stage, please be sure to evaluate the alternatives, such as REST.

  • liatliat liat USMember

    So,If I understand you correctly,
    If I'm developing it in WCF and expose it as SOAP SERVICE - it doesnt matter , still there is going to be a problem with it. right?

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    Not sure what you mean - I am not saying you will have a problem with WCF, just that you need to use the correct tool to generate the proxy, and that in many/most cases REST is easier and better.

    You can expose WCF via REST or SOAP. SOAP is certainly more complex.

  • liatliat liat USMember
    edited June 2013

    Hi,
    Lets say I expose WCF via Soap,
    In the guide you sent me there are 3 options
    soap,rest,wcf
    So can I use it with soap service instructions in the guide? or only with wcf instructions?
    (the same with exposing via rest?)

    (problem I mean not fully supported)

  • ChrisHonselaarChrisHonselaar Chris Honselaar NLBeta ✭✭✭

    The WCF instructions are for SOAP-based WCF. You would still follow the WCF section of the guide.

Sign In or Register to comment.