Tuesday, 20 August 2013

Object reference not set to an instance of an object while trying to assign soap parameter

Object reference not set to an instance of an object while trying to
assign soap parameter

I have imported wsdl in c # and trying to access the method.
srv_ind_dvm28aw.ExecuteTransactionService soapClient = new
srv_ind_dvm28aw.ExecuteTransactionService();
[WebMethod]
public void Transaction()
{
System.Net.ICredentials cred = new
System.Net.NetworkCredential("j", "j");
soapClient.Credentials = cred;
srv_ind_dvm28aw.CreateTransaction insert = new
srv_ind_dvm28aw.CreateTransaction();
srv_ind_dvm28aw.CreateTransactionResponse response = new
srv_ind_dvm28aw.CreateTransactionResponse();
try
{
insert.forminputdata.freeformcontrols.PrimaryAccID.Value = "24";
insert.forminputdata.freeformcontrols.SecondaryAccID.Value =
"22";
response = soapClient.CreateTransaction(insert);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
I have assigned two parameters PrimaryAccID and SecondaryAccID.Here i am
getting the error Object reference not set to an instance of an object.
here is the complete wsdl for the reference.
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:tns="http://schemas.cordys.com/default"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="ExecuteBPM.ExecuteTransaction"
targetNamespace="http://schemas.cordys.com/default"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns1="http://schemas.cordys.com/1.0/xforms/processapi"
attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://schemas.cordys.com/default"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import
namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:import namespace="http://schemas.cordys.com/bpm/instance/1.0" />
<xsd:import
namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:element name="CreateTransaction">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="tns1:forminputdata" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CreateTransactionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="data">
<xsd:complexType>
<xsd:all>
<xsd:element name="instance_id">
<xsd:annotation>
<xsd:documentation>This output parameter contains
the unique instance identifier for the
business-process.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="PAGEFLOWDATA">
<xsd:annotation>
<xsd:documentation>This optional output parameter
contains the response message from the
business-process and this is available only in case
of page flow processes.</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded"
processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://schemas.cordys.com/bpm/instance/1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import
namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:element name="headerInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="target" type="xsd:string" />
<xsd:element name="source">
<xsd:complexType>
<xsd:attribute name="type" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="bpm">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="instance_id" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://schemas.cordys.com/1.0/xforms/processapi"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="forminputdata">
<xsd:complexType>
<xsd:all>
<xsd:element name="freeformcontrols">
<xsd:complexType>
<xsd:all>
<xsd:element name="PrimaryAccID">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute default="Primary Acc ID"
name="display_name" type="xsd:string"
use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="SecondaryAccID">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute default="Secondary Acc ID"
name="display_name" type="xsd:string"
use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="CreateTransactionInput">
<wsdl:part name="body" element="tns:CreateTransaction" />
</wsdl:message>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="CreateTransactionOutput">
<wsdl:part name="body" element="tns:CreateTransactionResponse" />
</wsdl:message>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="HeaderOutput">
<wsdl:part name="BPMHeaderOutput" element="inst:bpm" />
</wsdl:message>
<wsdl:portType xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="ExecuteTransaction">
<wsdl:operation name="CreateTransaction">
<wsdl:input message="tns:CreateTransactionInput" />
<wsdl:output message="tns:CreateTransactionOutput" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="ExecuteTransaction" type="tns:ExecuteTransaction">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="CreateTransaction">
<soap:operation soapAction="" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:HeaderOutput" part="BPMHeaderOutput"
use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0"
name="ExecuteTransactionService">
<wsdl:port name="ExecuteTransactionPort"
binding="tns:ExecuteTransaction">
<soap:address
location="http://srv-ind-dvm28aw/cordys/com.eibus.web.soap.Gateway.wcp?organization=o=ewm,cn=cordys,cn=EWM_CU6,o=vanenburg.com&amp;SAMLart=MDFgZEgICDQ+u+3viuskQtM5/APNP1YhIhFVVVo/fvRCxKezFVk1Ltvx"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

No comments:

Post a Comment