Hi,
I'm new in Xamarin, and I'ld like to do a simple Hello World app. It communicate a NUSOAP webservice. My problem is the "Hello" function s.@return value always null, and I don't know why.
My webservice:
- require_once("nuSOAP/lib/nusoap.php");
- $namespace = "http://merszoftkft.hu/soap/index.php?wsdl";
-
- $server = new soap_server();
-
-
-
-
-
-
- $server->configureWSDL('TorzsadatLookup', $namespace);
-
-
- $server->wsdl->addComplexType('tResult','complexType','struct','all','',
- array(
- 'error_code' => array('name' => 'error_code','type' => 'xsd:int'),
- 'error_msg' => array('name' => 'error_msg','type' => 'xsd:string'),
- 'rows_count' => array('name' => 'rows_count','type' => 'xsd:int')
- ));
- $server->register(
-
- 'ConnTest',
-
- array(),
-
- array('return'=>'tns:tResult'),
-
- $namespace,
-
- false,
-
- 'rpc',
-
- 'encoded',
-
- 'Connection Test');
- function ConnTest()
- {
- $error_code=0;
- $error_msg="OK";
- $rows=0;
- return array('error_code'=>$error_code, 'error_msg'=>$error_msg, 'rows_count'=>$rows);
- }
- $server->register(
-
- "Hello",
-
- array('name' => 'xsd:string'),
-
- array('return'=>'xsd:string'),
-
- $namespace,
-
- false,
-
- 'rpc',
-
- 'literal',
-
- 'Connection Test');
- function Hello($name)
- {
- return "Hello " .$name;
- }
-
-
- $POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA'])
- ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
-
- $server->service($POST_DATA);
- exit();
- ?>
My code:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- using System.Data;
- using Microsoft.Data.SqlClient;
- using System.Net.NetworkInformation;
- using System.ServiceModel;
- using System.Collections.ObjectModel;
- namespace App3
- {
- public partial class MainPage : ContentPage
- {
- public MainPage()
- {
- InitializeComponent();
- }
- private void Button_Clicked(object sender, EventArgs e)
- {
- BasicHttpBinding binding = new BasicHttpBinding()
- {
- Name = "basicHttpBinding",
- MaxBufferSize = 2147483647,
- MaxReceivedMessageSize = 2147483647,
- TransferMode = TransferMode.StreamedRequest
- };
- TimeSpan timeout = new TimeSpan(0, 0, 30);
- binding.SendTimeout = timeout;
- binding.OpenTimeout = timeout;
- binding.ReceiveTimeout = timeout;
- ServiceReference1.TorzsadatLookupPortTypeClient cl = new ServiceReference1.TorzsadatLookupPortTypeClient(binding, new EndpointAddress("http://merszoftkft.hu/soap/index.php?wsdl"));
- ServiceReference1.HelloRequest hr = new ServiceReference1.HelloRequest()
- {
- name = "Joe"
- };
- ServiceReference1.HelloResponse s = cl.Hello(hr);
- if (s!=null)
- {
- webserviceResultLabel.Text = s.@return;
- }
- }
- }
- }