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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Custom call to from Thingworx to Windchill with SSO

RadekIOT
4-Participant

Custom call to from Thingworx to Windchill with SSO

Hello
I am trying to call Windchill custom url https://hostname/Windchill/servlet/custom/path
From Browser where SSO works it returns string value

However when I created Swagger connector with Configured SSO on Thingworx it returns

something like this 

RadekLisowski_0-1711713731302.png

ContentLoaderFunctions.GetText - works with basic Authentication but I need SSO

Any ides?

RadekIOT
7 REPLIES 7

What is the URL supposed to return, a String? It looks like it returns an object.

RadekIOT
4-Participant
(To:Rocko)

I want to run  https://hostname/Windchill/servlet/custom/getNumber?number=123456
with SSO
This URL returns in postman STRING text 

Code from bellow works but I need SSO. That's why I created Swagger connector

 

 

let headers = {
    "Accept": "text/plain",
    "Authorization": authorization
}
 
let params = {
  proxyScheme: undefined /* STRING {"defaultValue":"http"} */,
  headers: headers /* JSON */,
  ignoreSSLErrors: undefined /* BOOLEAN */,
  useNTLM: undefined /* BOOLEAN {"defaultValue":false} */,
  workstation: undefined /* STRING {"defaultValue":""} */,
  useProxy: undefined /* BOOLEAN {"defaultValue":false} */,
  withCookies: undefined /* BOOLEAN {"defaultValue":false} */,
  proxyHost: undefined /* STRING {"defaultValue":""} */,
  url: "https://hostname/Windchill/servlet/custom/getNumber?number=1234567" /* STRING */,
  timeout: undefined /* NUMBER {"defaultValue":60} */,
  appendHeader: undefined /* BOOLEAN {"defaultValue":true} */,
  proxyPort: undefined /* INTEGER {"defaultValue":8080} */,
  password: undefined /* STRING */,
  domain: undefined /* STRING {"defaultValue":""} */,
  username: undefined /* STRING */,
};
 
// result: STRING
let result = Resources["ContentLoaderFunctions"].GetText(params);

 

  

RadekIOT

I don't think ContentLoaderFunctions supports SSO. You probably have to use Thingworx Integration Runtime.

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

 

RadekIOT
4-Participant
(To:Rocko)

I created Swagger Connector

RadekIOT_0-1712049370411.png

SwaggerJSON value:

 

{
    "cosumes": [
        "text/html"
    ],
    "basePath": "/Windchill",
    "paths": {
        "/servlet/custom/getNumber": {
            "get": {
                "summary": "Get Parts of type Product",
                "responses": {
                    "200": {
                        "schema": {
                            "type": "string"
                        },
                        "description": "Successful operation"
                    },
                    "400": {
                        "schema": {
                            "type": "string"
                        },
                        "description": "Successful operation"
                    },
                    "404": {
                        "schema": {
                            "type": "string"
                        },
                        "description": "Successful operation"
                    },
                    "406": {
                        "schema": {
                            "type": "string"
                        },
                        "description": "Successful operation"
                    }
                },
                "description": "Get Number of type Product",
                "operationId": "Get_Number_of_type_Product",
                "parameters": [
                    {
                        "in": "query",
                        "uniqueItems": true,
                        "name": "numberRange",
                        "description": "",
                        "type": "string",
                        "required": false
                    }
                ],
                "tags": [
                    "CustomEndPoint"
                ]
            }
        }
    },
    "host": "hostname",
    "produces": [
        "text/plain"
    ],
    "schemes": [
        "https"
    ],
    "definitions": {},
    "swagger": "2.0",
    "info": {
        "description": "Retrieves Windchill Custom endpoints",
        "title": "Windchill Custom Endpoints",
        "version": "1.0.0"
    },
    "tags": [
        {
            "name": "CustomEndPoint"
        }
    ]
}

 

Service created for Route from JSON
returns:

RadekIOT_1-1712049506313.png

Return Value should be String

 

RadekIOT

Sorry, misread your message.

 

Nothing in the error logs?

Shouldn't "cosumes" be "consumes"?

 

RadekIOT
4-Participant
(To:Rocko)

Shouldn't "cosumes" be "consumes"?
- Did not helped
No Errors on Thingworx, on Integration Runtime, on Windchill

 

RadekIOT

No idea then, sorry. You can try to increase log levels, so you see the query being sent to and returned from Windchill, but if it does not give you an error, the query seems to be a missing type conversion somewhere, mime-type maybe?

You can also try to break it on purpose and see if that gives you different error message (e.g. try servlet/custom/getNumberXXX  instead of servlet/custom/getNumber

Announcements


Top Tags