• jteam12
  • NEWBIE
  • 0 Points
  • Member since 2010

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

I have imported a WSDL, Force.com has generated the classes, including several custom data type objects.  I can invoke the service and in the Force.com IDC using Execute Anonymous, I can see that the returned XML is what I expect.

 

But now I am having trouble figuring out how to get the results out of the response object.

 

The response message is structured something like the example below.  It is a query into an ERP system about product master data.

 

<response>

<material>

<ID>

<some property1 />

<some property2 />

</ID>

<description>

<some property3 />

</description>

</material>

</response>

 

The nodes that I want to get the values of are the ID and description nodes.  In my case, the levels beneth the ID and description notes are empty as a result of my request to the service.  So the response looks something like this:

 

<response>

<material>

<ID>123</ID>

<description>Some Material</description>

</material>

</response>

 

The APEX class that was generated from the WSDL has created <ID> and <description> each as classes, rather than primitives because each has lower level attributes.  

 

So the classes look something like this:

 

class response{

material mat;

}

 

class material{

ID internalID;

description desc;

}

 

class ID{

String some_property1;

String some_property2;

}

.

.

.

 

 

So, how do I access the value of the <ID> and <description> nodes from the response message?  

 

Another question: how can I view the content of the response object itself?  Is there a perspective in the Force.com IDE to view this?  I've used Flex Builder before and it lets you give the content of an object while debugging your code.  That would be helpful here so that I can see exactly how Force is building out the response object form the response message.

Hi,

 

I have a very basic APEX question.  How do I assign values to class variables?  Take the example below.  The last two lines give a compile time error of "unexpected token: '=' ".  The code below is just a simple snippet that I've created to demonstrate the problem that I'm having.  The actual code that I am working with is a generated class from importing a WSDL.  In my code, I'm trying to create an instance of the message class so that I can pass it to the service invocation method.  But, as you can see, I'm getting stuck just trying to assign values to the class.

 

 

public class exampleC {
public class outerClass{
public innerClass IC;
}
public class innerClass{
public String str;
}

outerClass out = new outerClass(); //not sure if this is necessary since I have not created a constructor 

 out.IC = new innerClass();

 out.IC.str = 'A string';  //it seems like this statement should be sufficient without the one above it.  

 

}

 

I have imported a WSDL, Force.com has generated the classes, including several custom data type objects.  I can invoke the service and in the Force.com IDC using Execute Anonymous, I can see that the returned XML is what I expect.

 

But now I am having trouble figuring out how to get the results out of the response object.

 

The response message is structured something like the example below.  It is a query into an ERP system about product master data.

 

<response>

<material>

<ID>

<some property1 />

<some property2 />

</ID>

<description>

<some property3 />

</description>

</material>

</response>

 

The nodes that I want to get the values of are the ID and description nodes.  In my case, the levels beneth the ID and description notes are empty as a result of my request to the service.  So the response looks something like this:

 

<response>

<material>

<ID>123</ID>

<description>Some Material</description>

</material>

</response>

 

The APEX class that was generated from the WSDL has created <ID> and <description> each as classes, rather than primitives because each has lower level attributes.  

 

So the classes look something like this:

 

class response{

material mat;

}

 

class material{

ID internalID;

description desc;

}

 

class ID{

String some_property1;

String some_property2;

}

.

.

.

 

 

So, how do I access the value of the <ID> and <description> nodes from the response message?  

 

Another question: how can I view the content of the response object itself?  Is there a perspective in the Force.com IDE to view this?  I've used Flex Builder before and it lets you give the content of an object while debugging your code.  That would be helpful here so that I can see exactly how Force is building out the response object form the response message.