SOAP Webservice met ComplexType consumeren

Status
Niet open voor verdere reacties.

smertens

Nieuwe gebruiker
Lid geworden
3 apr 2012
Berichten
1
Beste leden,

ik heb een vraag over het consumeren van een SOAP service in C#. Ik heb een soap server gemaakt m.b.v. NuSOAP en PHP en wil deze nu in een C# applicatie benaderen.
Als ik een methode (lookupContactPersonString) aanroep welke 1 waarde (xsd:string) teruggeeft dan werkt het goed; roep ik een methode aan met een complexType als resultaat (lookupContactPerson) dan krijg ik de melding "InvalidOperationException" met als InnerException 'When casting from a number, the value must be a number less than infinity'.

Zie hieronder mijn C# code:
Code:
private void button1_Click(object sender, EventArgs e)
        {
            string completeName = txtFirstName.Text + " " + txtMiddleName.Text + " " + txtLastName.Text;
            // check if there is enough info to validate
            if (txtCity.Text != "" & ((txtFirstName.Text != "" & txtLastName.Text != "") || (txtFirstName.Text != "" & txtMiddleName.Text != "" & txtLastName.Text != "")) &
                txtCompany.Text != "")
            {
                //string test3 = System.Configuration.ConfigurationSettings.AppSettings["Key3"];
                businessCardScanner service = new businessCardScanner();
                service.Credentials = System.Net.CredentialCache.DefaultCredentials;
                
                contactInformation lookupResult = new CardScanSDKDemo.Services.contactInformation();
                
                lookupResult = service.lookupContactPerson(txtCompany.Text, txtCity.Text, completeName);
                ShowMsg(lookupResult.busRelAccount);
                //ShowMsg(service.lookupContactPersonString(txtCompany.Text, txtCity.Text, completeName));
            }
            // else, warn the user
            else
                ShowMsg("No information to validate");
        }

Dit is mijn WSDL:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:/bi/general/businessCardScanner/lookup.php?wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:/bi/general/businessCardScanner/lookup.php?wsdl">
<types>
<xsd:schema targetNamespace="urn:/bi/general/businessCardScanner/lookup.php?wsdl"
>
 <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
 <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
 <xsd:complexType name="contactInformation">
  <xsd:all>
   <xsd:element name="busRelAccount" type="xsd:string"/>
   <xsd:element name="contactPersonId" type="xsd:string"/>
  </xsd:all>
 </xsd:complexType>
</xsd:schema>
</types>
<message name="lookupContactPersonRequest">
  <part name="busRelName" type="xsd:string" />
  <part name="busRelCity" type="xsd:string" />
  <part name="contactName" type="xsd:string" /></message>
<message name="lookupContactPersonResponse">
  <part name="return" type="tns:contactInformation" /></message>
<message name="lookupContactPersonStringRequest">
  <part name="busRelName" type="xsd:string" />
  <part name="busRelCity" type="xsd:string" />
  <part name="contactName" type="xsd:string" /></message>
<message name="lookupContactPersonStringResponse">
  <part name="return" type="xsd:string" /></message>
<portType name="businessCardScannerPortType">
  <operation name="lookupContactPerson">
    <input message="tns:lookupContactPersonRequest"/>
    <output message="tns:lookupContactPersonResponse"/>
  </operation>
  <operation name="lookupContactPersonString">
    <input message="tns:lookupContactPersonStringRequest"/>
    <output message="tns:lookupContactPersonStringResponse"/>
  </operation>
</portType>
<binding name="businessCardScannerBinding" type="tns:businessCardScannerPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="lookupContactPerson">
    <soap:operation soapAction="http://intranet/bi/general/businessCardScanner/lookup.php/lookupContactPerson" style="rpc"/>
    <input><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
  <operation name="lookupContactPersonString">
    <soap:operation soapAction="http://intranet/bi/general/businessCardScanner/lookup.php/lookupContactPersonString" style="rpc"/>
    <input><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
</binding>
<service name="businessCardScanner">
  <port name="businessCardScannerPort" binding="tns:businessCardScannerBinding">
    <soap:address location="http://intranet/bi/general/businessCardScanner/lookup.php"/>
  </port>
</service>
</definitions>

Kan iemand mij helpen en vertellen hoe ik deze methode dan wel aan zou kunnen spreken, zodat ik het complextype kan gebruiken?

Alvast bedankt!
Groeten Sander
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan