title: How to consume External SOAP based web services in java?
body: <p>I need to consume <a href="http://indblrp2p03.ad.infosys.com:8000/sap/bc/srt/wsdl/sdef_/INFYPE/SOAP_WS_SC_SEARCH/wsdl11/ws_policy/rpc?sap-client=200" rel="nofollow">http://indblrp2p03.ad.infosys.com:8000/sap/bc/srt/wsdl/sdef_/INFYPE/SOAP_WS_SC_SEARCH/wsdl11/ws_policy/rpc?sap-client=200</a> SOAP based webservice.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
  &lt;wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style"   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions"&gt;
   &lt;wsdl:documentation&gt;
   &lt;sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl" /&gt; 
   &lt;/wsdl:documentation&gt;
   &lt;wsp:UsingPolicy wsdl:required="true" /&gt; 
   &lt;wsp:Policy wsu:Id="IF_IF__-infype_-SOAP_WS_SC_SEARCH"&gt;
   &lt;sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/"&gt;
  &lt;sapsession:enableSession&gt;false&lt;/sapsession:enableSession&gt; 
  &lt;/sapsession:Session&gt;
  &lt;/wsp:Policy&gt;
  &lt;wsp:Policy wsu:Id="OP_IF_OP__-infype_-rfcShopcartSoapWs"&gt;
  &lt;sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/"&gt;false&lt;/sapcomhnd:enableCommit&gt; 
  &lt;sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/"&gt;true&lt;/sapblock:enableBlocking&gt; 
    &lt;saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/"&gt;no&lt;/saptrhnw05:required&gt; 
    &lt;saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/"&gt;false&lt;/saprmnw05:enableWSRM&gt; 
  &lt;/wsp:Policy&gt;
  &lt;wsdl:types&gt;
  &lt;xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions"&gt;
  &lt;xsd:simpleType name="byte16"&gt;
  &lt;xsd:restriction base="xsd:base64Binary"&gt;
   &lt;xsd:maxLength value="16" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char1"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="1" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char10"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="10" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
  &lt;xsd:simpleType name="char12"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="12" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char14"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="14" /&gt; 
    &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char2"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="2" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char20"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="20" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char21"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="21" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char220"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="220" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char30"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="30" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char32"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="32" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char40"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="40" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char50"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="50" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char54"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="54" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
     &lt;xsd:simpleType name="char60"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="60" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char8"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="8" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="char80"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="80" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="cuky5"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="5" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="curr13.2"&gt;
   &lt;xsd:restriction base="xsd:decimal"&gt;
   &lt;xsd:totalDigits value="13" /&gt; 
   &lt;xsd:fractionDigits value="2" /&gt; 
    &lt;/xsd:restriction&gt;
    &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="curr15.2"&gt;
   &lt;xsd:restriction base="xsd:decimal"&gt;
   &lt;xsd:totalDigits value="15" /&gt; 
   &lt;xsd:fractionDigits value="2" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
    &lt;xsd:simpleType name="date"&gt;
    &lt;xsd:restriction base="xsd:date"&gt;
    &lt;xsd:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}" /&gt; 
    &lt;/xsd:restriction&gt;
    &lt;/xsd:simpleType&gt;
    &lt;xsd:simpleType name="numeric10"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
    &lt;xsd:maxLength value="10" /&gt; 
    &lt;xsd:pattern value="\d*" /&gt; 
    &lt;/xsd:restriction&gt;
    &lt;/xsd:simpleType&gt;
    &lt;xsd:simpleType name="numeric2"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
    &lt;xsd:maxLength value="2" /&gt; 
    &lt;xsd:pattern value="\d*" /&gt; 
    &lt;/xsd:restriction&gt;
    &lt;/xsd:simpleType&gt;
    &lt;xsd:simpleType name="numeric3"&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
    &lt;xsd:maxLength value="3" /&gt; 
    &lt;xsd:pattern value="\d*" /&gt; 
     &lt;/xsd:restriction&gt;
    &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="numeric6"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
    &lt;xsd:maxLength value="6" /&gt;
    &lt;xsd:pattern value="\d*" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
    &lt;xsd:simpleType name="quantum13.3"&gt;
   &lt;xsd:restriction base="xsd:decimal"&gt;
   &lt;xsd:totalDigits value="13" /&gt; 
   &lt;xsd:fractionDigits value="3" /&gt; 
    &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
   &lt;xsd:simpleType name="unit3"&gt;
   &lt;xsd:restriction base="xsd:string"&gt;
   &lt;xsd:maxLength value="3" /&gt; 
   &lt;/xsd:restriction&gt;
   &lt;/xsd:simpleType&gt;
    &lt;xsd:complexType name="I"&gt;
   &lt;xsd:sequence /&gt; 
   &lt;/xsd:complexType&gt;
   &lt;/xsd:schema&gt;
   &lt;xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:n0="urn:sap-com:document:sap:rfc:functions"&gt;
   &lt;xsd:import namespace="urn:sap-com:document:sap:rfc:functions" /&gt; 
   &lt;xsd:complexType name="Bapiret2"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="Type" type="n0:char1" /&gt; 
   &lt;xsd:element name="Id" type="n0:char20" /&gt; 
   &lt;xsd:element name="Number" type="n0:numeric3" /&gt; 
   &lt;xsd:element name="Message" type="n0:char220" /&gt; 
   &lt;xsd:element name="LogNo" type="n0:char20" /&gt; 
   &lt;xsd:element name="LogMsgNo" type="n0:numeric6" /&gt; 
   &lt;xsd:element name="MessageV1" type="n0:char50" /&gt; 
   &lt;xsd:element name="MessageV2" type="n0:char50" /&gt; 
   &lt;xsd:element name="MessageV3" type="n0:char50" /&gt; 
   &lt;xsd:element name="MessageV4" type="n0:char50" /&gt; 
   &lt;xsd:element name="Parameter" type="n0:char32" /&gt; 
   &lt;xsd:element name="Row" type="xsd:int" /&gt; 
   &lt;xsd:element name="Field" type="n0:char30" /&gt; 
   &lt;xsd:element name="System" type="n0:char10" /&gt; 
   &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="_-infype_-strScLst"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="ScGuid" type="n0:byte16" /&gt; 
   &lt;xsd:element name="ScNo" type="n0:char10" /&gt; 
   &lt;xsd:element name="ScName" type="n0:char40" /&gt; 
   &lt;xsd:element name="ItemGuid" type="n0:byte16" /&gt; 
   &lt;xsd:element name="ItemNo" type="n0:numeric10" /&gt; 
   &lt;xsd:element name="ItemName" type="n0:char40" /&gt; 
   &lt;xsd:element name="NetPrice" type="n0:curr13.2" /&gt; 
   &lt;xsd:element name="ItemTotal" type="n0:curr15.2" /&gt; 
   &lt;xsd:element name="Currency" type="n0:cuky5" /&gt; 
   &lt;xsd:element name="TotalValue" type="n0:curr15.2" /&gt; 
   &lt;xsd:element name="PoNo" type="n0:char10" /&gt; 
   &lt;xsd:element name="ConfNo" type="n0:char10" /&gt; 
   &lt;xsd:element name="ScStatus" type="n0:numeric2" /&gt; 
   &lt;xsd:element name="ScStatusDesc" type="n0:char60" /&gt; 
   &lt;xsd:element name="ProductCat" type="n0:char20" /&gt; 
   &lt;xsd:element name="ProductCatDesc" type="n0:char80" /&gt; 
   &lt;xsd:element name="Quantity" type="n0:quantum13.3" /&gt; 
   &lt;xsd:element name="Uom" type="n0:unit3" /&gt; 
   &lt;xsd:element name="ProductType" type="n0:char2" /&gt; 
   &lt;xsd:element name="Purchteam" type="n0:char8" /&gt; 
   &lt;xsd:element name="ProductId" type="n0:char54" /&gt; 
   &lt;xsd:element name="CatalogId" type="n0:char20" /&gt; 
   &lt;xsd:element name="Catalogitem" type="n0:char40" /&gt; 
   &lt;xsd:element name="SupplierId" type="n0:char32" /&gt; 
   &lt;xsd:element name="SupplierName" type="n0:char40" /&gt; 
   &lt;xsd:element name="Flag" type="n0:char1" /&gt; 
   &lt;xsd:element name="ScNoCumItemno" type="n0:char21" /&gt; 
   &lt;xsd:element name="CreatedAt" type="n0:char10" /&gt; 
   &lt;xsd:element name="CreatedBy" type="n0:char12" /&gt; 
    &lt;xsd:element name="ChangedAt" type="n0:char10" /&gt; 
    &lt;xsd:element name="ChangedBy" type="n0:char12" /&gt; 
    &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="_-infype_-strRelatedDoc"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="SourceDoc" type="n0:char10" /&gt; 
   &lt;xsd:element name="RelatedDoc" type="n0:char10" /&gt; 
   &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="_-infype_-strDocumentSrch"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="DocNo" type="n0:char10" /&gt; 
   &lt;xsd:element name="DocName" type="n0:char40" /&gt; 
   &lt;xsd:element name="DocDateFrom" type="n0:date" /&gt; 
   &lt;xsd:element name="DocDateTo" type="n0:date" /&gt; 
   &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="_-infype_-strStatus"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="Status" type="xsd:int" /&gt; 
   &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="TableOfBapiret2"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="item" type="tns:Bapiret2" minOccurs="0" maxOccurs="unbounded" /&gt; 
   &lt;/xsd:sequence&gt;
   &lt;/xsd:complexType&gt;
   &lt;xsd:complexType name="TableOf_-infype_-strScLst"&gt;
   &lt;xsd:sequence&gt;
   &lt;xsd:element name="item" type="tns:_-infype_-strScLst" minOccurs="0" maxOccurs="unbounded" /&gt; 
    &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
    &lt;xsd:complexType name="TableOf_-infype_-strRelatedDoc"&gt;
    &lt;xsd:sequence&gt;
    &lt;xsd:element name="item" type="tns:_-infype_-strRelatedDoc" minOccurs="0" maxOccurs="unbounded" /&gt; 
    &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
    &lt;xsd:complexType name="TableOf_-infype_-strStatus"&gt;
     &lt;xsd:sequence&gt;
    &lt;xsd:element name="item" type="tns:_-infype_-strStatus" minOccurs="0" maxOccurs="unbounded" /&gt; 
    &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
    &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="_-infype_-rfcShopcartSoapWs"&gt;
    &lt;wsdl:part name="EtReturn" type="tns:TableOfBapiret2" /&gt; 
    &lt;wsdl:part name="EtScList" type="tns:TableOf_-infype_-strScLst" /&gt; 
    &lt;wsdl:part name="EtScPo" type="tns:TableOf_-infype_-strRelatedDoc" /&gt; 
    &lt;wsdl:part name="IsScSearch" type="tns:_-infype_-strDocumentSrch" /&gt; 
    &lt;wsdl:part name="ItScStatus" type="tns:TableOf_-infype_-strStatus" /&gt; 
    &lt;wsdl:part name="IvApprover" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvBuyer" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvCategoryId" type="n1:char20" /&gt; 
    &lt;wsdl:part name="IvCompletedCarts" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvDashboard" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvDbSearch" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvItemDesc" type="n1:char40" /&gt; 
    &lt;wsdl:part name="IvNoOfRecords" type="xsd:int" /&gt; 
    &lt;wsdl:part name="IvPoNumber" type="n1:char10" /&gt; 
    &lt;wsdl:part name="IvPurcGrp" type="n1:char14" /&gt; 
    &lt;wsdl:part name="IvPurcOrg" type="n1:char14" /&gt; 
    &lt;wsdl:part name="IvRequester" type="n1:char10" /&gt; 
    &lt;wsdl:part name="IvSupplier" type="n1:char10" /&gt; 
    &lt;wsdl:part name="IvTeamCart" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvTeamMember" type="n1:char12" /&gt; 
    &lt;wsdl:part name="IvUser" type="n1:char12" /&gt; 
    &lt;wsdl:part name="IvWithConf" type="n1:char1" /&gt; 
    &lt;wsdl:part name="IvWithPo" type="n1:char1" /&gt; 
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="_-infype_-rfcShopcartSoapWsResponse"&gt;
    &lt;wsdl:part name="EtReturn" type="tns:TableOfBapiret2" /&gt; 
    &lt;wsdl:part name="EtScList" type="tns:TableOf_-infype_-strScLst" /&gt; 
    &lt;wsdl:part name="EtScPo" type="tns:TableOf_-infype_-strRelatedDoc" /&gt; 
    &lt;wsdl:part name="EvCount" type="n1:I" /&gt; 
    &lt;wsdl:part name="ItScStatus" type="tns:TableOf_-infype_-strStatus" /&gt; 
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name="_-infype_-SOAP_WS_SC_SEARCH"&gt;
    &lt;wsp:Policy&gt;
    &lt;wsp:PolicyReference URI="#IF_IF__-infype_-SOAP_WS_SC_SEARCH" /&gt; 
    &lt;/wsp:Policy&gt;
    &lt;wsdl:operation name="_-infype_-rfcShopcartSoapWs"&gt;
    &lt;wsp:Policy&gt;
     &lt;wsp:PolicyReference URI="#OP_IF_OP__-infype_-rfcShopcartSoapWs" /&gt; 
    &lt;/wsp:Policy&gt;
    &lt;wsdl:input message="tns:_-infype_-rfcShopcartSoapWs" /&gt; 
    &lt;wsdl:output message="tns:_-infype_-rfcShopcartSoapWsResponse" /&gt; 
    &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>For the same I have created a webservice client in Eclipse, in result of which following number of classes appeared some of whose structure is given as follows:</p>
  
  <ul>
  <li>_Infype_StrDocumentSrch,</li>
  <li>_Infype_StrRelatedDoc,</li>
  <li>_Infype_StrScLst,     </li>
  <li>_Infype_StrStatus,</li>
  <li>Bapiret2 and I.java</li>
  </ul>
  
  <p>I am able to make the connection with the URL but not able to get the parameters listed in the XML like itemNo, itemName etc from the backend. Can anyone pls tell me how to interact with these above classes and get the required paramters and its respective values.</p>