.Net Soap Web Service Help


Licensed User
Longtime User
I wrote a very simple .Net web service (SOAP) that returned a hello message. Used Download method and message xml returned perfectly.
Sub Globals
   Dim b4a As String
   b4a = ""
End Sub
Sub Activity_Create(FirstTime As Boolean)
   HttpUtils.CallbackActivity = "Main" 'Current activity name.
   HttpUtils.CallbackJobDoneSub = "JobDone"
   HttpUtils.Download("Job1", b4a)
End Sub

I then changed the service to accept an input parameter and switched to HttpUtils2. I cannot get it to respond. Using PostString fails and Downloads2 returns an XML that basically says the service was not found. Same case whether I use service.asmx?op=HelloWorld or service.asmx/HelloWorld.
Sub Activity_Create(FirstTime As Boolean)
   Dim job1 As HttpJob
   job1.Initialize("Job1", Me)
   'job1.Download2("", Array As String("Msg", "HelloTablet"))
        ' Download2 xml returned service not found
   'job1.PostString("", "Msg=HelloTablet")
        ' PostString Fails
End Sub

I’m new at this so any help would be greatly appreciated.


B4X founder
Staff member
Licensed User
Longtime User
Your first code is equivalent to:
I do not know if this is the problem however you should either put all the parameters in the URL or all of the parameters in the array:
Job1.Download2("", Array As String("op", "HelloWorld", "Msg", "HelloTablet"))
Upvote 0


Licensed User
Longtime User
Soap Help

Thanks for the reply but I must be a brick as I'm still not connecting. I have tried several combinations of URL definitions and trying Download2 & PostString to no avail. This is the Soap Post from the browser:
PPOST /TryAgain/TGSfiles.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetCustomer"

<?xml version="1.0" encoding="utf-8"?>
<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/">
    <GetCustomer xmlns="http://tempuri.org/">

This is what I have coded:
   Dim Url As String
   Url = ""
   Dim job1 As HttpJob
   job1.Initialize("Job1", Me)
    'job1.Download2(Url, Array As String ("op", "GetCustomer", "CNO", "ME"))   
   job1.PostString(Url, "CNO=ME")
Any advice is greatly appreciated.
Upvote 0


Licensed User
Longtime User
Part II

Now that I have that solved I have another question. I'm accessing corporate data through a web service. These files have fixed length data fields (similar to strings) that can contain binary zeros so I don't think I can declare them as strings. Is there a declaration I can use to define fixed blocks of data?
Upvote 0


Licensed User
Longtime User
Web Service response (file) into customer type

I have a custom type defining a complex data structure downloaded from a web service. I can’t seem to “load” this structure no matter how I try. I tried loading the structure into a map but accessing the map after the read only returns nulls. I would like to be able to load the custom type directly from the download and access its members. Can this be done?
Upvote 0


Licensed User
Longtime User
Not in XML

The XML is returning a filename (files is made of byte arrays, Integers, double, etc). I then execute a download of the file. The file is received - all that works perfectly. I want to load the file into a custom type that has every field defined. This record isn't a SQL record but more of a traditional mainframe file. FYI here is the Type definition::BangHead:

Type Item(Number (20) As Byte, _
   Department (10) As Byte, _
   Category (10) As Byte, _
   SubCat (10) As Byte, _
   Description (40) As Byte, _
   Package (2) As Byte, _
   Pack As Int, _                           
   InvCtlFlag As Byte, _                        
   UniqueStyle As Byte, _                        
   StyleNumber As Int, _                         
   PostAccount (6) As Byte, _                      
   QuantityPrompt As Byte, _                       
   SkipLabel As Byte, _                         
   FoodStampOk As Byte, _                         
   HasInstruction As Byte, _                       
   HasSalesQue As Byte, _                        
   AgePrompt As Byte, _                         
   LoyaltyExempt As Byte, _                       
   Deactivated As Byte, _                        
   BackroomSkip As Byte, _                        
   Filler (2) As Byte, _                            
   UpdateTag As Byte, _
   KeyStore (4) As Byte, _
   Dnumber (20) As Byte, _                         
   Top (8) As Byte, _                            
   Down (8) As Byte, _                           
   BarcodeScan (20) As Byte, _                       
   AltLookup (20) As Byte, _                        
   BinLoc (10) As Byte, _                         
   FreezeTag As Byte, _                          
   AutoDelete As Byte, _                         
   TaxFlag (4) As Byte, _                         
   NoDiscounts As Byte, _                         
   CommissionOver As Byte, _                        
   CommissionPct As Int, _                        
   FixedCommission As Double, _                       
   SpifOveride As Byte, _                         
   Spif As Double, _                            
   AltTaxRate As Int, _                         
   AvgCost As Double, _                          
   LastCost As Double, _
   PriceBlock (120) As Byte, _
    MarkupBlock (99) As Byte, _
   DateAdded (4) As Byte, _                        
   DateMaInt (4) As Byte, _                        
   SaleDate (4) As Byte, _
   SaleOffDate (4) As Byte, _                       
   DateLastSale (4) As Byte, _                      
   DateLastReturn (4) As Byte, _                      
   Qinv As Double, _                            
   CommittedQoh As Double, _                        
   LayAWay As Double, _ 
   QuantityBo As Double, _                        
   BreakNumber (20) As Byte, _                       
   SubstitutionNo (20) As Byte, _ 
   OrderBlock (96) As Byte, _
   Tare As Int, _                              
   CrbkExempt As Byte, _                         
   LockPrice As Byte, _                          
   Weight (7) As Byte, _                          
   SdQtyTrigger As Int, _                   
   SdQtyRecv As Int, _                    
   SaleStartTime (4) As Byte, _                      
   SaleStopTime (4) As Byte, _                      
   ExemptionOveride As Byte, _                        
   Fractions As Byte, _
   NoZeroPrompt As Byte, _                        
   Ziller (39) As Byte)
Upvote 0


Licensed User
Longtime User

Closing this post as requested. Thanks for your help and direction. Everything is working great. :sign0060:
Upvote 0