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 7524527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:06:21+00:00 2026-05-30T03:06:21+00:00

<?xml version=1.0 encoding=UTF-8?> <S:Envelope xmlns:S=http://schemas.xmlsoap.org/soap/envelope/> <S:Header/> <S:Body> <ns2:FReadStatus xmlns:ns2=http://poweb13/> <arg0>000D6F0000</arg0> </ns2:FReadStatus> </S:Body> </S:Envelope> i’m

  • 0
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header/>
    <S:Body>
        <ns2:FReadStatus xmlns:ns2="http://poweb13/">
            <arg0>000D6F0000</arg0>
        </ns2:FReadStatus>
    </S:Body>
</S:Envelope>

i’m working in an android project which i want to consume some JAX-WS. The services are made by someone else so i can’t change anything of them.I want to sent the above SOAP message with this written code but the only thing i receive when call them is java.lang.NullPointerException

private static final String NAMESPACE = "http://poweb13/";
private static final String URL = "http://smart.gr:8080/aWESoME/SmartPlugService?wsdl"; 
private static final String SOAP_ACTION = "SmartPlugService";
private static final String METHOD_NAME = "FReadStatus";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
PropertyInfo p1 = new PropertyInfo();
p1.setName("MAC");
p1.setValue("000D6F0000");
p1.setType(myDevice.getmac().toString().getClass());
request.addProperty(p1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {           
    androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");                 
    androidHttpTransport.call(SOAP_ACTION, envelope);
    SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
    String result=resultsRequestSOAP.getProperty("return").toString();
    Log.i("info","Received :" + result);
} catch (java.lang.ClassCastException e){
    SoapFault fault=(SoapFault)envelope.bodyIn;
    Log.e("error","Received :" + fault.getMessage().toString());
    Log.e("error","Received :" + fault.getLocalizedMessage().toString());
    StackTraceElement[] st=fault.getStackTrace();
    for(int i=0;i<st.length;i++){
        Log.e("error","Received :" +st[i] );
    }
} catch (Exception e) {
    Log.e("error","smthing went wrong!!");
    e.printStackTrace();
}

I think that it doesn’t create a xml document even, but i don’t know how to check it. I tried to create a XmlSerializer to put data for creating xml but i also receive a NullPointerException.
So can anyone help me about how to code the above request?
here’s some parts of wsdl file

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://poweb13/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://poweb13/" name="SmartPlugService">
<types>
<xsd:schema>
<xsd:import namespace="http://poweb13/" schemaLocation="http://smart.gr:8080/aWESoME/SmartPlugService?xsd=1"/>
</xsd:schema>
</types>


<message name="FReadStatus">
<part name="parameters" element="tns:FReadStatus"/>
</message>
...
<portType name="SmartPlugService">
<operation name="FReadStatus">
...
<input wsam:Action="http://poweb13/SmartPlugService/FReadStatusRequest" message="tns:FReadStatus"/>
<output wsam:Action="http://poweb13/SmartPlugService/FReadStatusResponse" message="tns:FReadStatusResponse"/>
<fault message="tns:InvalidDeviceAddressException" name="InvalidDeviceAddressException" wsam:Action="http://poweb13/SmartPlugService/FReadStatus/Fault/InvalidDeviceAddressException"/>
<fault message="tns:InternalServiceException" name="InternalServiceException" wsam:Action="http://poweb13/SmartPlugService/FReadStatus/Fault/InternalServiceException"/>
...
</operation>
</portType>
<binding name="SmartPlugServicePortBinding" type="tns:SmartPlugService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
...
<operation name="FReadStatus">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="InvalidDeviceAddressException">
<soap:fault name="InvalidDeviceAddressException" use="literal"/>
</fault>
<fault name="InternalServiceException">
<soap:fault name="InternalServiceException" use="literal"/>
</fault>
</operation>
...
</binding>

Some parts of xsd file

<xs:schema xmlns:tns="http://poweb13/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://poweb13/">
<xs:element name="FReadStatus" type="tns:FReadStatus"/>
<xs:complexType name="FReadStatus">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

i should have a SOAP response like this:

SOAP Response

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:FReadStatusResponse xmlns:ns2="http://poweb13/">
            <return>1</return>
        </ns2:FReadStatusResponse>
    </S:Body>
</S:Envelope>
  • 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-30T03:06:22+00:00Added an answer on May 30, 2026 at 3:06 am

    Ok so you have a function FReadStatus:

    <message name="FReadStatus">
      <part name="parameters" element="tns:FReadStatus"/>
    </message>
    

    which has an element FReadStatus of complex type(ie object, which is a class found on the server).
    This complex type has an attribute arg0 of type String. Its definition is:

    <xs:complexType name="FReadStatus">
      <xs:sequence>
        <xs:element name="arg0" type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
    

    So you will need to create a local class that implements kvmSerializable to map this complex type to its corresponding class on the server, so you will do :

    public class FReadStatus implements KvmSerializable {
    
    String mac; 
    
    @Override
    public Object getProperty(int arg0) {
    switch (arg0){
        case 0:
            return mac;
        default:
            return null;
            }
    }
    
    @Override
    public int getPropertyCount() {
        return 1;//because you have 1 parameter
    }
    
    @Override
    public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
    switch(arg0)
    {
    
        case 0:
            arg2.type = PropertyInfo.STRING_CLASS;//because its type is string
            arg2.name = "arg0";
            break;
        default:break;
    }
    
    }
    
    @Override
    public void setProperty(int arg0, Object arg1) {
    switch(arg0)
    {
        case 0:
            mac=  (String)arg1;
            break;
        default:
            break;
    }
    }
    

    Now that you have the class , you will do the following in the code you had:

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
    
        PropertyInfo pi = new PropertyInfo();
        pi.setName("arg0");
        pi.setValue("000D6F0000");
        pi.setType(FReadStatus .class);
        request.addProperty(pi);
    
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
        envelope.setOutputSoapObject(request);
    
         //Now you have to add mapping to map the local class created, to the one on the server
        envelope.addMapping(NAMESPACE , FReadStatus.class.getSimpleName(), FReadStatus .class);
    
        // Add marshalling (this one might not be necessary, but ill just add it)
        Marshal floatMarshal = new MarshalFloat();
        floatMarshal.register(envelope);
    
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);//AndroidHttpTransport INSTEAD OF HttpTransportSE 
    
        androidHttpTransport.debug = true;//NEW ADDED
        try {           
    
            androidHttpTransport.call(SOAP_ACTION, envelope);
    
           //Important Outputs to check how the request/Response looks like.. Check them in Logcat to find these outputs
           System.out.println("requestDump is :"+androidHttpTransport.requestDump);
           System.out.println("responseDump is :"+androidHttpTransport.responseDump);
           System.out.println("response"+envelope.getResponse());
    
        } catch (Exception e){}
    

    Let me know wt happens. You must use Logcat to check requestDump and responseDump

    UPDATE: answering your question about UnknowHostException
    possible causes and solutions

    • Check if in your AndroidManifest.xml you have :

      <uses-permission android:name="android.permission.INTERNET" />
      
    • If you are using an emulator do as mentioned in this link

    • If you are behind a proxy do :

      System.setProperty("http.proxyHost", "my.proxyhost.com");
      System.setProperty("http.proxyPort", "1234");
      
    • You might need to use warmup the dns , check this link

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

Sidebar

Related Questions

<?xml version=1.0 encoding=UTF-8?> <soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/><env:Header xmlns:env=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance/><soapenv:Body><v9:ProcessShipmentReply xmlns:v9=http://fedex.com/ws/ship/v9><v9:HighestSeverity xmlns:env=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance>SUCCESS</v9:HighestSeverity><v9:Notifications xmlns:env=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance><v9:Severity>SUCCESS</v9:Severity><v9:Source>ship</v9:Source><v9:Code>0000</v9:Code><v9:Message>Success</v9:Message><v9:LocalizedMessage>Success</v9:LocalizedMessage></v9:Notifications><v9:Version> <v9:ServiceId>ship</v9:ServiceId> <v9:Major>9</v9:Major>
I have a SOAP Call that looks like this: <?xml version=1.0 encoding=utf-8?><soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/
I'm using the Spring WS version 1.5.8. My response looks like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/>
I've a SOAP response in a var $soap_response like this: <SOAP-ENV:Envelope SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema
I have the generic structure here: <?xml version=1.0 encoding=UTF-8?> <SOAP-ENV:Envelope xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/ xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/
I'm using the an API, and I get this kind of response: <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
Ok my wsdl server is expecting this as a call : <soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/ xmlns:esc=http://escoles.webservice.jovtitus.dasc.gencat.net
Is this even valid? XmlDocument doc = new XmlDocument(); doc.InnerXml = @<?xml version='1.0' encoding='utf-8'?><soap:Envelope
How do i parse json by removing the xml tag <?xml version=1.0 encoding=utf-8?> <soap:Envelope
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1

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.