cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

SOAP library for third-party apps

ptc-5501799
1-Newbie

SOAP library for third-party apps

Hi all,

I'm new to windchill and what I'm trying to do is pretty much what Rick was trying to do here (a remote integration with windchill). I read the User's guide, the section about the web service tooling, how to create a web service and the section about the available webjects.

What i don't understand is how those webjects are exposed to a third-party application. There's a list of (SOAP) web services already implemented and available to use? Or do I have to create tasks that use these webjects and than create the web services for these tasks?

I hope i was clear, Marco.


1 ACCEPTED SOLUTION

Accepted Solutions

The following is the solution i found (just in case someone is having the same problem i had).

All the xml files containing the tasks are stored under <windchill_folder>/tasks and they implement the webjects specified in the Adapter Guide. The parameters required to access them from an external application are specifid in some sort of wsdl accessible from a browser at the address: <windchill_url>/Windchill/servlet/SimpleTaskDispatcher?CLASS=<task_package> (where <task_package> is something like "com.ptc.windchill.ws").

To access those tasks I used a standalone java application. This example prints on the system-out the UFID of all the resources of type "Part":

private static ConnectionFactory getManualFactory() throws PropertyVetoException, IOException, ResourceException {

IeManagedConnectionFactory mcf = new IeManagedConnectionFactory();

mcf.setConnectionImplementation("com.infoengine.connector.HTTPConnection");

mcf.setConnectionProperties ("ConnectionURL=http://windchill.mydomain.lan/Windchill/servlet/SimpleTaskDispatcher" );

return (ConnectionFactory) mcf.createConnectionFactory();

}

public static void main(String[] args) throws NamingException, ResourceException, PropertyVetoException, IOException{

ConnectionFactory cxf = getManualFactory();

Connection cx = null;

try {

IeConnectionSpec cxSpec = new IeConnectionSpec();

cxSpec.setUserName("myuser");

cxSpec.setPassword("mypassword");

cx = cxf.getConnection(cxSpec);

Interaction ix = cx.createInteraction();

IeInteractionSpec ixSpec = new IeInteractionSpec();

ixSpec.setClassName("com.ptc.windchill.ws");

ixSpec.setFunctionName("Query");

RecordFactory rFact = cxf.getRecordFactory();

MappedRecord iRec = rFact.createMappedRecord("QueryRequestMsg");

iRec.put("typeIdentifier", "wt.part.WTPart"); //wt.org.WTUser

iRec.put("criteria", "name = *");

iRec.put("attribute", "name");

IeInteractionResult result = (IeInteractionResult) ix.execute(ixSpec, iRec);

Object[] res = (Object[])result.getResult();

for(Object r : res){

System.out.println("ufid: " + ((Element)r).getUfid());

}

}catch(Throwable e){

System.err.println("error: "+e);

} finally {

if (cx != null) {

cx.close();

}

System.exit(0);

}

}

The required dependencies are:

ieWeb.jar, ie3rdpartylibs.jar, CommonCore.jar, WebServices.jar, ptcCoreFCS.jar, servlet.jar all available inside the windchill installation folder (under different paths).

View solution in original post

1 REPLY 1

The following is the solution i found (just in case someone is having the same problem i had).

All the xml files containing the tasks are stored under <windchill_folder>/tasks and they implement the webjects specified in the Adapter Guide. The parameters required to access them from an external application are specifid in some sort of wsdl accessible from a browser at the address: <windchill_url>/Windchill/servlet/SimpleTaskDispatcher?CLASS=<task_package> (where <task_package> is something like "com.ptc.windchill.ws").

To access those tasks I used a standalone java application. This example prints on the system-out the UFID of all the resources of type "Part":

private static ConnectionFactory getManualFactory() throws PropertyVetoException, IOException, ResourceException {

IeManagedConnectionFactory mcf = new IeManagedConnectionFactory();

mcf.setConnectionImplementation("com.infoengine.connector.HTTPConnection");

mcf.setConnectionProperties ("ConnectionURL=http://windchill.mydomain.lan/Windchill/servlet/SimpleTaskDispatcher" );

return (ConnectionFactory) mcf.createConnectionFactory();

}

public static void main(String[] args) throws NamingException, ResourceException, PropertyVetoException, IOException{

ConnectionFactory cxf = getManualFactory();

Connection cx = null;

try {

IeConnectionSpec cxSpec = new IeConnectionSpec();

cxSpec.setUserName("myuser");

cxSpec.setPassword("mypassword");

cx = cxf.getConnection(cxSpec);

Interaction ix = cx.createInteraction();

IeInteractionSpec ixSpec = new IeInteractionSpec();

ixSpec.setClassName("com.ptc.windchill.ws");

ixSpec.setFunctionName("Query");

RecordFactory rFact = cxf.getRecordFactory();

MappedRecord iRec = rFact.createMappedRecord("QueryRequestMsg");

iRec.put("typeIdentifier", "wt.part.WTPart"); //wt.org.WTUser

iRec.put("criteria", "name = *");

iRec.put("attribute", "name");

IeInteractionResult result = (IeInteractionResult) ix.execute(ixSpec, iRec);

Object[] res = (Object[])result.getResult();

for(Object r : res){

System.out.println("ufid: " + ((Element)r).getUfid());

}

}catch(Throwable e){

System.err.println("error: "+e);

} finally {

if (cx != null) {

cx.close();

}

System.exit(0);

}

}

The required dependencies are:

ieWeb.jar, ie3rdpartylibs.jar, CommonCore.jar, WebServices.jar, ptcCoreFCS.jar, servlet.jar all available inside the windchill installation folder (under different paths).

Top Tags