• Sk_rk
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Hello Salesforce gurus,

 

I am new to SFDC and I am running into a roadblock with the following WSDL which I am trying to generate APEX code.

 

The WSDL successfully got parsed but the APEX code generation failed fatally.

 

The error message while generating the APEX code is

 

Error: Unsupported WSDL. Found more than one part for message CostaAuthenticatorInput

 

Any workaround to solve this would be awesome. Your help is hightly appreciated.

 

Thanks in advance.

 

Sk_rk

 

The actual WSDL is below

 

<?xml version = '1.0' encoding = 'UTF-8'?>
<definitions name="CostaFinder" targetNamespace="http://xmlns.costamesa.com/module/" xmlns:tns="http://xmlns.costamesa.com/module/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns1="http://xmlns.costamesa.com/module/test/">
   <types>
<schema targetNamespace="http://xmlns.costamesa.com/module/test/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:db="http://xmlns.costamesa.com/module/test/" elementFormDefault="qualified">
   <element name="CostaIn">
      <complexType>
         <sequence>
            <element name="Param1" type="string" db:index="1" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
            <element name="Param2" type="string" db:index="2" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
         </sequence>
      </complexType>
   </element>
   <element name="CostaOut">
      <complexType>
         <sequence>
            <element name="CostaAuthenticator" type="string" db:index="0" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
         </sequence>
      </complexType>
   </element>
         <element name="MyHeader">
            <complexType>
               <sequence>
                  <element name="Param3" minOccurs="0" type="string"/>
                  <element name="Param4" minOccurs="0" type="string"/>
               </sequence>
            </complexType>
         </element>

</schema>
   </types>
   <message name="CostaAuthenticatorInput">
      <part name="header" element="tns1:MyHeader"/>
      <part name="body" element="tns1:CostaIn"/>
   </message>
   <message name="CostaAuthenticatorOutput">
      <part name="body" element="tns1:CostaOut"/>
   </message>
   <portType name="CostaFinder_PortType">
      <operation name="CostaAuthenticator">
         <input message="tns:CostaAuthenticatorInput"/>
         <output message="tns:CostaAuthenticatorOutput"/>
      </operation>
   </portType>
   <binding name="CostaFinder_Binding" type="tns:CostaFinder_PortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="CostaAuthenticator">
         <soap:operation soapAction="http://costamesa:8076/webservices/server"/>
         <input>
            <soap:header message="tns:CostaAuthenticatorInput" part="header" use="literal"/>
            <soap:body parts="body" use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
      </operation>
   </binding>
   <service name="CostaFinder_Service">
      <port name="CostaFinder_Port" binding="tns:CostaFinder_Binding">
         <soap:address location="http://costamesa:8076/webservices/server"/>
      </port>
   </service>
</definitions>

  • July 30, 2010
  • Like
  • 0

I need to accomplish the following from within a button on the accounts page:

 

take customer account address

send SOAP request with address

receive SOAP response

update salesforce account information depending upon response

 

I am a bit overwhelmed with trying to plot out the best way to accomplish this.  The salesforce developer library is so powerful I don't know where to begin. 

 

It seems there are a number of ways I could do this, either through a visualforce page which I assume would easily be able to update the data, but I am unsure of how to embed a SOAP request and parsing the response, or via an externally linked page, which would then update the salesforce via an API after the response has been parsed.  Any thoughts would be greatly appreciated.

 

 

Hello Salesforce gurus,

 

I am new to SFDC and I am running into a roadblock with the following WSDL which I am trying to generate APEX code.

 

The WSDL successfully got parsed but the APEX code generation failed fatally.

 

The error message while generating the APEX code is

 

Error: Unsupported WSDL. Found more than one part for message CostaAuthenticatorInput

 

Any workaround to solve this would be awesome. Your help is hightly appreciated.

 

Thanks in advance.

 

Sk_rk

 

The actual WSDL is below

 

<?xml version = '1.0' encoding = 'UTF-8'?>
<definitions name="CostaFinder" targetNamespace="http://xmlns.costamesa.com/module/" xmlns:tns="http://xmlns.costamesa.com/module/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns1="http://xmlns.costamesa.com/module/test/">
   <types>
<schema targetNamespace="http://xmlns.costamesa.com/module/test/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:db="http://xmlns.costamesa.com/module/test/" elementFormDefault="qualified">
   <element name="CostaIn">
      <complexType>
         <sequence>
            <element name="Param1" type="string" db:index="1" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
            <element name="Param2" type="string" db:index="2" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
         </sequence>
      </complexType>
   </element>
   <element name="CostaOut">
      <complexType>
         <sequence>
            <element name="CostaAuthenticator" type="string" db:index="0" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
         </sequence>
      </complexType>
   </element>
         <element name="MyHeader">
            <complexType>
               <sequence>
                  <element name="Param3" minOccurs="0" type="string"/>
                  <element name="Param4" minOccurs="0" type="string"/>
               </sequence>
            </complexType>
         </element>

</schema>
   </types>
   <message name="CostaAuthenticatorInput">
      <part name="header" element="tns1:MyHeader"/>
      <part name="body" element="tns1:CostaIn"/>
   </message>
   <message name="CostaAuthenticatorOutput">
      <part name="body" element="tns1:CostaOut"/>
   </message>
   <portType name="CostaFinder_PortType">
      <operation name="CostaAuthenticator">
         <input message="tns:CostaAuthenticatorInput"/>
         <output message="tns:CostaAuthenticatorOutput"/>
      </operation>
   </portType>
   <binding name="CostaFinder_Binding" type="tns:CostaFinder_PortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="CostaAuthenticator">
         <soap:operation soapAction="http://costamesa:8076/webservices/server"/>
         <input>
            <soap:header message="tns:CostaAuthenticatorInput" part="header" use="literal"/>
            <soap:body parts="body" use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
      </operation>
   </binding>
   <service name="CostaFinder_Service">
      <port name="CostaFinder_Port" binding="tns:CostaFinder_Binding">
         <soap:address location="http://costamesa:8076/webservices/server"/>
      </port>
   </service>
</definitions>

  • July 30, 2010
  • Like
  • 0

Hi,

 

My webservice expects the security header to have username, password, password type and timestamp.

I am stuck with an issue and would like some assistance.

 

My Webservice code is

    public static void setupSecurity(Object service) {

        org.apache.cxf.endpoint.Client client = org.apache.cxf.frontend.ClientProxy.getClient(service);

        org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();

        Map<String, Object> outProps= new HashMap<String, Object>();

        outProps.put(WSHandlerConstants.ACTION,

                WSHandlerConstants.USERNAME_TOKEN + ' ' + WSHandlerConstants.TIMESTAMP);

        outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);

        outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());

        outProps.put(WSHandlerConstants.USER, "Admin");

        PhaseInterceptor<SoapMessage> wssOut = new WSS4JOutInterceptor(outProps);

        cxfEndpoint.getOutInterceptors().add(wssOut);

        cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());

    }

 

As PasswordType also has to be sent as part of SOAP header i updated the WSDL.

Below is partial WSDL

 <xsd:schema elementFormDefault="qualified" targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" >
     <xsd:element name="Security" type="s3:SecurityHeaderType"/>
       <xsd:complexType name="SecurityHeaderType">
        <xsd:sequence>
          <xsd:element minOccurs="1" maxOccurs="1" name="UsernameToken" type="s3:UsernameToken"/>
          <xsd:element minOccurs="1" maxOccurs="1" name="TimeStamp" type="s3:TimeStamp"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="UsernameToken">
        <xsd:sequence>
          <xsd:element minOccurs="0" maxOccurs="1" name="Username" type="xsd:string"/>
          <xsd:element  minOccurs="1" maxOccurs="1" name="Password">
           <xsd:complexType>
             <xsd:simpleContent>
                 <xsd:extension base="xsd:string">
                       <xsd:attribute name="Type" type="xsd:string"/>
                     </xsd:extension>
              </xsd:simpleContent>
          </xsd:complexType>
           </xsd:element>         
         </xsd:sequence>
      </xsd:complexType>
    
      <xsd:complexType name="TimeStamp">
        <xsd:sequence>
          <xsd:element minOccurs="0" maxOccurs="1" name="Created" type="xsd:dateTime"/>
          <xsd:element minOccurs="0" maxOccurs="1" name="Expires" type="xsd:dateTime"/>
        </xsd:sequence>
      </xsd:complexType>

    </xsd:schema>

 

I added attribute Type for the Password element in WSDL. The Webservice is using PasswordText as the type.

 

Below is the generated code of the security class

public class OasisSecurity {
    public class Password_element {
        public String Type_x;
        private String[] Type_x_att_info = new String[]{'Type'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class TimeStamp {
        public DateTime Created;
        public DateTime Expires;
        private String[] Created_type_info = new String[]{'Created','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
        private String[] Expires_type_info = new String[]{'Expires','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'Created','Expires'};
    }
    public class UsernameToken {
        public String Username;
        public OasisSecurity.Password_element Password;
        private String[] Username_type_info = new String[]{'Username','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Password_type_info = new String[]{'Password','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','Password_element','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'Username','Password'};
    }
    public class SecurityHeaderType {
        public OasisSecurity.UsernameToken UsernameToken;
        public OasisSecurity.TimeStamp TimeStamp;
        private String[] UsernameToken_type_info = new String[]{'UsernameToken','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','UsernameToken','1','1','false'};
        private String[] TimeStamp_type_info = new String[]{'TimeStamp','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','TimeStamp','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
        private String[] field_order_type_info = new String[]{'UsernameToken','TimeStamp'};
    }
}

 

The problem i am facing is, i am able to assign value to the Type_x of the Password_element class.

But i am unable to set the value to the Password .

 

This is how the header part of my request looks like

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>Administrator</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" /></UsernameToken><TimeStamp><Created>2010-07-28T17:42:25.966Z</Created><Expires>2010-11-25T17:42:25.966Z</Expires></TimeStamp></Security></env:Header>

 And it can be seen in header that i am just able to pass the attribute Type of Password tag and unable to set Value for Password.

 

I am getting the below error message after the webservice callout.

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Fault occurred while processing. faultcode=ns1:client faultactor=

 

Any help on this will be highly appreciated.