Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Using KSoap2 with VB.Net webservice

Using KSoap2 with VB.Net webservice

Put your problem here if it does not fit any of the other categories.

Using KSoap2 with VB.Net webservice

Postby MaximG » Wed Apr 15, 2009 4:07 am

Hello All,
I am having some serious difficulty using KSoap2 to connect to a VB.Net webservice and am hoping I could get some help from someone who is smarter than me. I have been trying to work this out for 2 weeks with no luck.

So this is my problem. Using KSoap2 on the Android platform I have successfully queried a super simple web service that I created using vb.net (It can be found at http://gershwinsolutions.ftpaccess.cc/2 ... rvice.asmx)
I receive a XML result which looks quite reasonable to me.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. ReturnCustomerObject2Response{
  2.  
  3. ReturnCustomerObject2Result=anyType{CustomerID=1; FirstName=This is a test; };
  4.  
  5. }
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


However at the point where I try to cast the object I am returning from the webservice into a KvmSerializable object (as required by KSoap2) I receive a java.lang.ClassCastException.


This is my object (I have excluded imports for brevity):

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public abstract class BaseObject implements KvmSerializable {
  2.  
  3.    
  4.  
  5.     public BaseObject() {
  6.  
  7.         super();
  8.  
  9.     }
  10.  
  11. }
  12.  
  13. public class Customer extends BaseObject {
  14.  
  15.        
  16.  
  17.         private int m_CustomerID;
  18.  
  19.         private String m_FirstName;
  20.  
  21.         public static Class<? extends Customer> Customer_CLASS = new Customer().getClass();
  22.  
  23.        
  24.  
  25.        
  26.  
  27.        
  28.  
  29.         public void setCustomerID(int CustomerID) {
  30.  
  31.                 m_CustomerID = CustomerID;
  32.  
  33.         }
  34.  
  35.         public int getCustomerID() {
  36.  
  37.                 return m_CustomerID;
  38.  
  39.         }
  40.  
  41.         public void setFirstName(String FirstName) {
  42.  
  43.                 m_FirstName = FirstName;
  44.  
  45.         }
  46.  
  47.         public String getFirstName() {
  48.  
  49.                 return m_FirstName;
  50.  
  51.         }
  52.  
  53.        
  54.  
  55.        
  56.  
  57.     public void getPropertyInfo(int index, Hashtable properties, PropertyInfo info) {
  58.  
  59.         switch (index)
  60.  
  61.         {
  62.  
  63.         case 0:
  64.  
  65.             info.type = PropertyInfo.INTEGER_CLASS;
  66.  
  67.             info.name = "CustomerID";
  68.  
  69.             break;
  70.  
  71.         case 1:
  72.  
  73.             info.type = PropertyInfo.STRING_CLASS;
  74.  
  75.             info.name = "FirstName";
  76.  
  77.             break;
  78.  
  79.         default:
  80.  
  81.             break;
  82.  
  83.        
  84.  
  85.         }
  86.  
  87.     }
  88.  
  89.  
  90.  
  91.        
  92.  
  93.         @Override
  94.  
  95.         public Object getProperty(int index)
  96.  
  97.     {
  98.  
  99.                 switch (index) {
  100.  
  101.         case 0:
  102.  
  103.             return m_CustomerID;
  104.  
  105.         case 1:
  106.  
  107.             return m_FirstName;
  108.  
  109.         default:
  110.  
  111.             return null;
  112.  
  113.         }
  114.  
  115.     }
  116.  
  117.        
  118.  
  119.         @Override
  120.  
  121.     public int getPropertyCount() {
  122.  
  123.         return 2;
  124.  
  125.     }
  126.  
  127.  
  128.  
  129.  
  130.  
  131.         @Override
  132.  
  133.         public void setProperty(int index, Object value) {
  134.  
  135.  
  136.  
  137.                 switch (index) {
  138.  
  139.         case 0:
  140.  
  141.             m_CustomerID = Integer.parseInt(value.toString());
  142.  
  143.             break;
  144.  
  145.         case 1:
  146.  
  147.                  m_FirstName = value.toString();
  148.  
  149.              break;
  150.  
  151.         default:
  152.  
  153.             break;
  154.  
  155.         }
  156.  
  157.  
  158.  
  159.         }
  160.  
  161. }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


This is my request:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. private static final String SOAP_ACTION = "http://tempuri.org/ReturnCustomerObject2";
  3.  
  4. private static final String METHOD_NAME = "ReturnCustomerObject2";
  5.  
  6. private static final String NAMESPACE = "http://tempuri.org/";
  7.  
  8. private static final String URL = "http://10.0.2.2/2DoWebService.asmx";
  9.  
  10.  
  11.  
  12. public Boolean ExecuteSoapAction() {
  13.  
  14.         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  15.  
  16.         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  17.  
  18.         envelope.encodingStyle = SoapSerializationEnvelope.XSD;
  19.  
  20.         envelope.setOutputSoapObject(request);         
  21.  
  22.         envelope.addMapping("http://tempuri.org/ReturnCustomerObject2", "ReturnCustomerObject2", new Customer().getClass());
  23.  
  24.  
  25.  
  26.         envelope.dotNet = true;
  27.  
  28.        
  29.  
  30.         Customer Cust = new Customer();        
  31.  
  32.        
  33.  
  34.         HttpTransportSE HttpTransport = new HttpTransportSE(URL);
  35.  
  36.         HttpTransport.debug = true;
  37.  
  38.         try {
  39.  
  40.                 HttpTransport.call(SOAP_ACTION, envelope);
  41.  
  42. //HERE IS WHERE IT ALL GOES HORRIBLY WRONG!!
  43.  
  44.                 Cust = (Customer) envelope.getResponse();
  45.  
  46.         }
  47.  
  48.         catch (Exception ex) {
  49.  
  50.                 ex.printStackTrace();
  51.  
  52.         }
  53.  
  54.         return false;
  55.  
  56.     }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
MaximG
Freshman
Freshman
 
Posts: 3
Joined: Wed Apr 15, 2009 3:55 am

Top

Postby MaximG » Thu Apr 16, 2009 3:30 pm

Anyone have any ideas?
MaximG
Freshman
Freshman
 
Posts: 3
Joined: Wed Apr 15, 2009 3:55 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 8 guests