Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6566759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:15:14+00:00 2026-05-25T14:15:14+00:00

This is the scenario: I have a WCF service running, who communicates with this

  • 0

This is the scenario: I have a WCF service running, who communicates with this method, in C#:

 public bool ValidateUser(UserPass up)
    {
        initializeAttributes();
        IMembershipService Member = new AccountMembershipService();
        bool login = Member.ValidateUser(up.User, up.Pass);
        return login;
    }

The parameter are encapsulated in this class:

[DataContract]
public class UserPass
{
    string user = "";
    string pass = "";
    string email = "";

    [DataMember]
    public string User
    {
        get { return user; }
        set { user = value; }
    }

    [DataMember]
    public string Pass
    {
        get { return pass; }
        set { pass = value; }
    }

    [DataMember]
    public string Email
    {
        get { return email; }
        set { email = value; }
    }
}

Now, I want to connect to the server via an Android application, now, my question is, how can I replicate the UserPass class in Java, so the ValidateUser method can receive its parameter in a way it can understands it.

for reference, this is the code where I’m obtaining the User and Password:

private void validateUser(String user, String pass)
{

    String SOAP_ACTION = "http://tempuri.org/IUserService/ValidateUser/";
    String METHOD_NAME = "ValidateUser";
    String NAMESPACE = "http://tempuri.org/";
    String URL = "http://10.0.2.2/UserService.svc";

    AlertDialog popup;

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    request.addProperty(user, pass);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.bodyOut = request;
    envelope.dotNet = true;

    HttpTransportSE httpTransport = new HttpTransportSE(URL);

    try
    {
        httpTransport.call(SOAP_ACTION, envelope); //here's the exception!!
        Object response = envelope.getResponse();

        popup = createAlertDialog("Respuesta",response.toString(),"OK");
        popup.show();
    }
    catch (Exception exception)
    {
        String exceptionStr=exception.toString();

        popup = createAlertDialog("Exception!!",exceptionStr,"OK"); 
        popup.show();
    }       
}

The exception it throws is xmlpullparserexception, which, according to my understanding, is because of a missmatch between the parameters of the request and the actual method.

Many thanks for reading my question, and many more for those who can answer it 🙂

EDIT:

I finnaly got how to compare the XMLs… now, this is what my SOAP is providing:

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:d="http://www.w3.org/2001/XMLSchema" 
xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
    <ValidateUser xmlns="http://tempuri.org/" id="o0" c:root="1">
        <User i:type="d:string">someuser</User>
        <Pass i:type="d:string">somepass</Pass>
    <Email i:type="d:string"></Email>
    </ValidateUser>
</v:Body>

and this is what it SHOULD have made (retrieved from WCF Test Client application from Visual Studio 2010):

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IUserService/ValidateUser</Action>
  </s:Header>
  <s:Body>
    <ValidateUser xmlns="http://tempuri.org/">
      <up xmlns:d4p1="http://schemas.datacontract.org/2004/07/LiveAndesWCF" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <d4p1:Email i:nil="true" />
        <d4p1:Pass>somepass</d4p1:Pass>
        <d4p1:User>someuser</d4p1:User>
      </up>
    </ValidateUser>
  </s:Body>
</s:Envelope>

Now, I’m lost on how to code my soap code to have it generate a xml file like the latter one.

Many thanks again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:15:15+00:00Added an answer on May 25, 2026 at 2:15 pm

    This line looks suspect to me:

    request.addProperty(user, pass);
    

    As far as I can tell, SoapObject comes from the KSOAP2 library, and according to the docs, addProperty takes the name of the property and the value. To set user and pass, I would expect something more like this:

    request.addProperty("user", user);
    request.addProperty("pass", pass);
    

    Currently, it looks like you’re adding a single property named using the value of the user parameter. If the endpoint is expecting at least 2 arguments, then this could be the source of your mismatch.

    Also, is the value “Email”, from the UserPass wrapper class, optional? As I don’t see it being set anywhere, and the wrapper class suggests it’s required by the SOAP request

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine this scenario: you have a WCF web service that gets hit up to
Here is the scenario. I have a WCF service, when this service is called
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
Here is my scenario: I have a wcf service hosted in IIS. The wcf
We have a WCF service method (synchronous), which calls another process (through COM) to
I have a locally hosted WCF service that communicates with Paypal's API to take
The scenario is we have a WCF service that consumes methods from an internal
I'm wondering if anyone can help me. I have a wcf service running over
Consider this scenario that two WCF clients connect to one WCF service(server), this service
For this WCF service I have developed, I have to set MaxReceivedMessageSize to 5MB.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.