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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Infoengine based webservice

RG_10893406
7-Bedrock

Infoengine based webservice

I am using Windchill PDMLink Release 12.1 and Datecode with CPS 12.1.2.0

i have created the infoengine based webservice. While running webservice client i got the below error in windchill shell
Exception in thread "main" com.ptc.jws.service.org.myorg.mathservice.Exception_Exception: com.infoengine.exception.fatal.IEForbiddenException

Here are the errors that I faced
Exception in thread "main" com.ptc.jws.service.org.myorg.mathservice.Exception_Exception: com.infoengine.exception.fatal.IEForbiddenException

ACCEPTED SOLUTION

Accepted Solutions

 

@RG_10893406 

If you are running task using Http. i.e directly using browser.

Then add access="http|internal" after <%page language="java"

 

https://www.ptc.com/en/support/article/CS143385

View solution in original post

2 REPLIES 2

<%@page language="java"%>
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<%@taglib uri="/com/infoengine/tlds/iejstl.tld" prefix="c"%>
InfoEngine WebService:

<!--com.infoengine.soap.rpc.def
Generates the sum of two integers.
<p>Supply two integers, a and b. You can subtract
integers using the {@link Subtract} method.

@param int a The first integer.
@param int b The second integer.
@return int ${output[0]result[0]} The sum of a and b.
@see Multiply
@see Divide
@see Subtract
-->
<ie:webject name="Create-Group" type="GRP">
<ie:param name="GROUP_OUT" data="output"/>
</ie:webject>
<!-- just so non-web service clients could call this task
coerce a to an int, in case it isn’t already -->
<c:set var="A" value="${0+@FORM[0]a[0]}" />
<c:set var="${output[0]result}" value="${A+@FORM[0]b[0]}" />

 

Client:

package org.myorg;
 
// import the classes generated when compiling your client
import com.ptc.jws.client.handler.*;
import com.ptc.jws.service.org.myorg.mathservice.*; 
 
public class MathClient
{
    public static void main ( String [] args ) throws java.lang.Exception
    {
        Credentials.setUsername ( "wcadmin" );
        Credentials.setPassword ( "wcadmin" );
       int a = args.length > 0 ? Integer.parseInt ( args[0] ) : 0; 
        int b = args.length > 1 ? Integer.parseInt ( args[1] ) : 0; 
        MathServiceImplService service = new MathServiceImplService();
        MathServiceImpl port = service.getMathServiceImplPort ();
System.out.printf ( "a+b=%d\n", port.add ( a, b ) );  
    }
}

ERROR: 

Exception in thread "main" com.ptc.jws.service.org.myorg.mathservice.Exception_Exception: com.infoengine.exception.fatal.IEForbiddenException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:114)
at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:223)
at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:176)
at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:263)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:88)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:61)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:131)
at com.sun.proxy.$Proxy44.add(Unknown Source)
at org.myorg.MathClient.main(Unknown Source)

 

I followed CS226238 article to generate infoengine based webservice

 

 

@RG_10893406 

If you are running task using Http. i.e directly using browser.

Then add access="http|internal" after <%page language="java"

 

https://www.ptc.com/en/support/article/CS143385

Announcements

Top Tags