WolfgangBaeck
14 years agoNew Contributor
Failed to Dispatch Script, Null Pointer Exception
Hello,
Thannks for reading this and helping.
I've created a project (I'm a newcomer) based on a wsdl with mockup service etc. I copied the script from the sample project and modified it like this:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
def username = holder.getNodeValue( "//username" )
// validate
if( username == "VREDDY")
return "OK Response"
return "Vendor Not Found"
I get the null pointer exception when I try to run it.
Wolfgang
Here is the wsdl:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:p1="urn:BizTalk:ServicePoc" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" name="si_getlist_out" targetNamespace="urn:BizTalk:ServicePoc">
<wsdl:documentation />
<wsp:UsingPolicy wsdl:required="true" />
<wsp:Policy wsu:Id="OP_si_getVendor" />
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:BizTalk:ServicePoc" targetNamespace="urn:BizTalk:ServicePoc">
<xsd:element name="mt_getuserdetailrequest" type="dt_getuserdetailrequest" />
<xsd:element name="mt_getuserdetailresponse" type="dt_getuserdetailresponse" />
<xsd:complexType name="dt_getuserdetailresponse">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">
34b8b214cd0511e0c105000002a4e1d6
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="E_RETURN" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0ecd0511e0b3f800059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TYPE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c04cd0511e09afb00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ID" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c05cd0511e08ed700059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="NUMBER" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c06cd0511e0a83a00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c07cd0511e0bf6000059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LOG_NO" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c08cd0511e0be8d00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LOG_MSG_NO" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c09cd0511e0b6ed00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V1" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0acd0511e0b14500059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V2" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0bcd0511e0c64800059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V3" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0ccd0511e0cebd00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V4" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0dcd0511e0981f00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="E_VENDORS" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c10cd0511e0c6b700059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ITEM" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0fcd0511e0ca9f00059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MANDT" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676aecd0611e0ab1000059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="BNAME" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676afcd0611e08d3a00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OBJTYPE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b0cd0611e093fb00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OBJKEY" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b1cd0611e097f200059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SUBSYSTEM" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b2cd0611e0a5fc00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="dt_getuserdetailrequest">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">
22c6920dccef11e088b9000002a4e1d6
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="username" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="mt_getuserdetailrequest">
<wsdl:documentation />
<wsdl:part name="mt_getuserdetailrequest" element="p1:mt_getuserdetailrequest" />
</wsdl:message>
<wsdl:message name="mt_getuserdetailresponse">
<wsdl:documentation />
<wsdl:part name="mt_getuserdetailresponse" element="p1:mt_getuserdetailresponse" />
</wsdl:message>
<wsdl:portType name="si_getlist_out">
<wsdl:documentation />
<wsdl:operation name="si_getVendor">
<wsdl:documentation />
<wsp:Policy>
<wsp:PolicyReference URI="#OP_si_getVendor" />
</wsp:Policy>
<wsdl:input message="p1:mt_getuserdetailrequest" />
<wsdl:output message="p1:mt_getuserdetailresponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="si_getlist_outBinding" type="p1:si_getlist_out">
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="si_getVendor">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://sap.com/xi/WebService/soap1.1" />
<wsdl:input>
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XI_db5ac8ee02723c54ad37373e53d3e72f_Service">
<wsdl:port name="HTTP_Port" binding="p1:si_getlist_outBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://pidci01.alarismed.com:50400/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_BizTalk&receiverParty=&receiverService=&interface=si_getlist_out&interfaceNamespace=urn%3ABizTalk%3AServicePoc" />
</wsdl:port>
<wsdl:port name="HTTPS_Port" binding="p1:si_getlist_outBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="https://pidci01.alarismed.com:50401/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_BizTalk&receiverParty=&receiverService=&interface=si_getlist_out&interfaceNamespace=urn%3ABizTalk%3AServicePoc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Thannks for reading this and helping.
I've created a project (I'm a newcomer) based on a wsdl with mockup service etc. I copied the script from the sample project and modified it like this:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
def username = holder.getNodeValue( "//username" )
// validate
if( username == "VREDDY")
return "OK Response"
return "Vendor Not Found"
I get the null pointer exception when I try to run it.
Wolfgang
Here is the wsdl:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:p1="urn:BizTalk:ServicePoc" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" name="si_getlist_out" targetNamespace="urn:BizTalk:ServicePoc">
<wsdl:documentation />
<wsp:UsingPolicy wsdl:required="true" />
<wsp:Policy wsu:Id="OP_si_getVendor" />
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:BizTalk:ServicePoc" targetNamespace="urn:BizTalk:ServicePoc">
<xsd:element name="mt_getuserdetailrequest" type="dt_getuserdetailrequest" />
<xsd:element name="mt_getuserdetailresponse" type="dt_getuserdetailresponse" />
<xsd:complexType name="dt_getuserdetailresponse">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">
34b8b214cd0511e0c105000002a4e1d6
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="E_RETURN" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0ecd0511e0b3f800059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TYPE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c04cd0511e09afb00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ID" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c05cd0511e08ed700059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="NUMBER" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c06cd0511e0a83a00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c07cd0511e0bf6000059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LOG_NO" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c08cd0511e0be8d00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LOG_MSG_NO" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c09cd0511e0b6ed00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V1" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0acd0511e0b14500059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V2" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0bcd0511e0c64800059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V3" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0ccd0511e0cebd00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MESSAGE_V4" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0dcd0511e0981f00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="E_VENDORS" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c10cd0511e0c6b700059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ITEM" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
cb625c0fcd0511e0ca9f00059a3c7800
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MANDT" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676aecd0611e0ab1000059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="BNAME" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676afcd0611e08d3a00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OBJTYPE" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b0cd0611e093fb00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OBJKEY" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b1cd0611e097f200059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SUBSYSTEM" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
131676b2cd0611e0a5fc00059a3c7800
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="dt_getuserdetailrequest">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">
22c6920dccef11e088b9000002a4e1d6
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="username" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="mt_getuserdetailrequest">
<wsdl:documentation />
<wsdl:part name="mt_getuserdetailrequest" element="p1:mt_getuserdetailrequest" />
</wsdl:message>
<wsdl:message name="mt_getuserdetailresponse">
<wsdl:documentation />
<wsdl:part name="mt_getuserdetailresponse" element="p1:mt_getuserdetailresponse" />
</wsdl:message>
<wsdl:portType name="si_getlist_out">
<wsdl:documentation />
<wsdl:operation name="si_getVendor">
<wsdl:documentation />
<wsp:Policy>
<wsp:PolicyReference URI="#OP_si_getVendor" />
</wsp:Policy>
<wsdl:input message="p1:mt_getuserdetailrequest" />
<wsdl:output message="p1:mt_getuserdetailresponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="si_getlist_outBinding" type="p1:si_getlist_out">
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="si_getVendor">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://sap.com/xi/WebService/soap1.1" />
<wsdl:input>
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XI_db5ac8ee02723c54ad37373e53d3e72f_Service">
<wsdl:port name="HTTP_Port" binding="p1:si_getlist_outBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://pidci01.alarismed.com:50400/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_BizTalk&receiverParty=&receiverService=&interface=si_getlist_out&interfaceNamespace=urn%3ABizTalk%3AServicePoc" />
</wsdl:port>
<wsdl:port name="HTTPS_Port" binding="p1:si_getlist_outBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="https://pidci01.alarismed.com:50401/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_BizTalk&receiverParty=&receiverService=&interface=si_getlist_out&interfaceNamespace=urn%3ABizTalk%3AServicePoc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>