function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eager-2-LearnEager-2-Learn 

Certificate and SOAP

Hi,

Do you know what would be necessary if our SFDC ORG has apex code that creates the SOAP message programmatically (we are not using WSDL at all).  But now the system we are sending our data to requires authetication.  Is there something that has to be handled in code to add to the SOAP message since it is built by code or is there a point and click way to get the Cerfiticate that they gave me?

 

Thank you for your help.

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
sdetweilsdetweil

I don't know of any classes.. haven't had a programming class since my carpooling days in 74/75..(learning 370 assembler one instruction a day)..

 

I guess I don't understand the WSDL issue.. usually there are 4 or 5 'functions' that the WSDL exposes.. not 100's.

 

and the SF wsdl2pex builds functions to match the wsdl functions.. you should be able to search the source for the names.. but you shouldn't even NEED to do that..

 

if u know what the functions are (create, update, delete, ...) those wil be the names of the functions in the apex class too..

 

wsdl2apex will just generate some compound class names..

for example in my WSDL(which I built by hand using the Eclipse WSDL Editor)

 

 <xsd:schema targetNamespace="http://www.ca.com/RTCDefect/" 

 

the parameters

      <xsd:element name="CreateItem">
        <xsd:complexType>
          <xsd:sequence>
              <xsd:element maxOccurs="1" minOccurs="1" name="problem" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="summary" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="description" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="priority" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="severity" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="product" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="author" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="created" type="xsd:dateTime"/>

              <xsd:element maxOccurs="1" minOccurs="0" name="impact" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="1" minOccurs="0" name="circumvention" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="1" minOccurs="0" name="howtoreproduce" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="unbounded" minOccurs="1" name="cases" type="dft:wsCase"/>
              <xsd:element maxOccurs="unbounded" minOccurs="0" name="comments" type="dft:wsComment"/>
              <xsd:element maxOccurs="unbounded" minOccurs="0" name="attachments" type="dft:wsAttachment"/>

          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

 

the method

    <wsdl:operation name="CreateItem">
      <soap:operation soapAction="http://www.ca.com/RTCDefect/CreateItem"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

 

and in apex (on import u are asked for a name, this is the 4h version for me)

 

public class wwwCaComRtcdefectNew4 

 

and the method (operation)

 

public String CreateItem(String problem,String summary,String description,String priority,String severity,String product,String author,DateTime created,String impact,String circumvention,String howtoreproduce,wwwCaComRtcdefectNew4.wsCase[] cases,wwwCaComRtcdefectNew4.wsComment[] comments,wwwCaComRtcdefectNew4.wsAttachment[] attachments)

 

I still think the best way to learn this is download the eclipse developer tool with the J2EE or WST parts. and then you can visualize this..

http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/indigosr1

 

its really not hard..

 

Sam

All Answers

sdetweilsdetweil

could you have built a manual WSDL to shortcut all the coding to build the message and protocol handlers?

 

 a search on 'certificate' pulled up this topic, which describes what u have to do.. but it appears

you need to START with a WSDL

 

http://boards.developerforce.com/t5/Apex-Code-Development/Mutual-SSL-on-WebSvc-callouts-getting-a-jump-on-Summer-08/m-p/77553

 

Sam

Eager-2-LearnEager-2-Learn

Since I am trying to pick all this up as I go along I am not sure if they could have built the WSDL manually!  I am not sure how I would go about any of this stuff. 

 

This is what I know:

 

We did receive a WSDL from the team that is charge of the system we are sending data to.  But the contractors that are building this chose to hard code the entire SOAP Envelope/package based on what the WSDL required.  I think I got that right.  I actually see the code that builds the message piece by piece getting data and building the tags.

 

Are you saying the better way would have been to consume the WSDL from the other team?  I know they had done that originally because I remember looking at the classes that were generated but I think they thought it was too difficult to figure out how to use the classes!  I know I remember looking at the different class and I couldn't figure it out either.

 

It seems like I am missing the basic understanding of reading these classes that get generated from the WSDL because I have done an example in SFDC documents and without the document I would not have understood what to do.  So I am thinking that I need some documenation that starts tfrom the ground up (crawl, walk then run)! 

 

Any suggestions on where to get more examples because I want to make sure our SFDC ORG gets the best implementations possible in the future.

sdetweilsdetweil

built the code by hand? wow thats a lot of energy spent that could have been used for something valuable.

 

download Eclipse J2EE or with the WST package.

 

this provides nice editor support for creating WSDLs and building code from WSDL.

(u can edit the wsdl u have too to see the methods and message formats visually)

 

WSDL is nothing more than data structures and apis.(methods)

 

once u have a simple WSDL then u can use the Eclipse code to generate all the code required to BE the server side

use the Axis2 1.1 support function, and your wsdl will genrrate a WSDLnameSkeleton.java file.. with your 'methods'

and the parameters as u defined them in the WSDL.

 

then u take that same WSDL and create an APEX class from the wsdl.

 

there is no 'magic' here,  you will end up with methods to call to match your WSDL, and 'classes' to support your  parameters

 

this is just for education, to see how it fits together.. then u can call the apex class and see the message show up on your server.

 

this should take a days worth of fiddling for the first time.

build the wsdl,

generate the server code

   add some messages to the skeleton

setup a web server in eclipse (file->new->other->servers->)

add your generated server app to the server

 

use the same WSDL to create an APEX class

create an apex controller class that will create an instance of the web service class, and call the web service method

create a short VF page to invoke the controller..

 

these last 2 are the only coding, and should be 20 lines of code/VF total.

 

Once u do all this the real WSDL generated code won't be mysterious anymore.

 

I'm in central timezone.. if u get the eclipse installed and still get stuck we could talk/screen share.

a year ago I hadn't done any of this either.

 

Eager-2-LearnEager-2-Learn

I appreciate all this information and the fact that you have taken so much to to help me but this is well over my head.

 

I would be better served if I knew a course or beginner (thorough) tutorial for all that you mention. Do yo know of any course that are free or cost?

 

The IT department has given me a WSDL and when it was imported into SFDC it created all these classes but the contract team on the SFDC side decided to hardcode SOAP envelope.

I was able to use the SoapUI application to help assist with testing by copying the completed envelope that they built and had to go the SFDC logs.  From there I pasted it in the Soap UI applicaiton and run it to find out errors.  This is about the extend of knowledge base that I have managed to grab.

 

I simply can't seem to get a simple easy way to to gain this knowledge like back in the days of learning dBase or VB when there was a single book that gave you the basics examples that worked and then you grew from there!

sdetweilsdetweil

I don't know of any classes.. haven't had a programming class since my carpooling days in 74/75..(learning 370 assembler one instruction a day)..

 

I guess I don't understand the WSDL issue.. usually there are 4 or 5 'functions' that the WSDL exposes.. not 100's.

 

and the SF wsdl2pex builds functions to match the wsdl functions.. you should be able to search the source for the names.. but you shouldn't even NEED to do that..

 

if u know what the functions are (create, update, delete, ...) those wil be the names of the functions in the apex class too..

 

wsdl2apex will just generate some compound class names..

for example in my WSDL(which I built by hand using the Eclipse WSDL Editor)

 

 <xsd:schema targetNamespace="http://www.ca.com/RTCDefect/" 

 

the parameters

      <xsd:element name="CreateItem">
        <xsd:complexType>
          <xsd:sequence>
              <xsd:element maxOccurs="1" minOccurs="1" name="problem" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="summary" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="description" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="priority" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="severity" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="product" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="author" type="xsd:string"/>
              <xsd:element maxOccurs="1" minOccurs="1" name="created" type="xsd:dateTime"/>

              <xsd:element maxOccurs="1" minOccurs="0" name="impact" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="1" minOccurs="0" name="circumvention" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="1" minOccurs="0" name="howtoreproduce" type="xsd:string">
              </xsd:element>
              <xsd:element maxOccurs="unbounded" minOccurs="1" name="cases" type="dft:wsCase"/>
              <xsd:element maxOccurs="unbounded" minOccurs="0" name="comments" type="dft:wsComment"/>
              <xsd:element maxOccurs="unbounded" minOccurs="0" name="attachments" type="dft:wsAttachment"/>

          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

 

the method

    <wsdl:operation name="CreateItem">
      <soap:operation soapAction="http://www.ca.com/RTCDefect/CreateItem"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

 

and in apex (on import u are asked for a name, this is the 4h version for me)

 

public class wwwCaComRtcdefectNew4 

 

and the method (operation)

 

public String CreateItem(String problem,String summary,String description,String priority,String severity,String product,String author,DateTime created,String impact,String circumvention,String howtoreproduce,wwwCaComRtcdefectNew4.wsCase[] cases,wwwCaComRtcdefectNew4.wsComment[] comments,wwwCaComRtcdefectNew4.wsAttachment[] attachments)

 

I still think the best way to learn this is download the eclipse developer tool with the J2EE or WST parts. and then you can visualize this..

http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/indigosr1

 

its really not hard..

 

Sam

This was selected as the best answer
Eager-2-LearnEager-2-Learn

Thank you--I will download the tools for eclipse and take it from there.  Give me a day or two and I will give you an update.  Thank you so much for your feedback and suggestions.

sdetweilsdetweil

and my direct email is my username here, on gmail..

 

I would be glad to talk to you directly to get you over the hump

 

Sam

Eager-2-LearnEager-2-Learn

That is a very nice offer.  I wll be shooting you an email.  In the meantime which project to I create within eclipse.  The eclipse that I currently use with SFDC does not have as many different types of projects as the eclipse that you refereed me to.  Would it be the Web service project?