Is it possible to return a WSDL using the WSDL/XSD resources within a proxy

I want to be able to return a WSDL directly from Apigee but don't want to have to pre-process the WSDL in order to include it within a policy within Apigee. I would like to be able to upload the WSDL and XSD as separate resources within the proxy and then have the proxy return the content from the WSDL/XSD resources files when a ?wsdl request is received.

Is this something that would be possible if I were to write my own Java or JavaScript callout?

1 8 893
8 REPLIES 8

Not quite.

It's not quite possible to do it that way.

It is possible to ALMOST do what you want.

You can use the resourceURL attribute of the Payload element, like this:

<AssignMessage name='AM-WSDLResponse'>
  <Set>
    <Payload contentType='text/xml' resourceURL='template://mywsdl.wsdl'/>
  </Set>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <AssignTo createNew='false' transport='http' type='response'/>
</AssignMessage>

Attach that in a response flow and it will send back the contents of the .wsdl file in the payload of the response.

But to make this happen, you need to register the file mywsdl.wsdl as a resource of type "template". (not wsdl)

See attached for a working example.

apiproxy-wsdl-test.zip

Thanks @Dino-at-Google that almost accomplishes what I want. It would be great if Apigee supported returning the wsdl resource directly from within the Assign Message policy.

What I am trying to accomplish is using the same WSDL resource for both SOAP Message Validation and the "Get WSDL" request. Can JavaScript callouts read the WSDL resource into a variable? I could then read it in and load it to a variable that could then be referenced in the Assign Message policy.

I found an example (https://github.com/yuriylesyuk/edge-soap-validate) of someone adding support for schema validation using the existing paths found within the WSDL. In that example it looks like a JavaCallout would be able to read the resource file and store in a variable. I was hoping something similar could be accomplished using JavaScript.

It would be great if Apigee supported returning the wsdl resource directly from within the Assign Message policy.

I agree!

Can JavaScript callouts read the WSDL resource into a variable?

Nope 😞

I think to better support your requirement, we'd need to enhance the product.

I can enter a support ticket if needed to request support for returning the WSDL type from the Assign Message policy?

Also I wasn't able to find any documentation on the template resource type? Is it new?

I don't think so. Hmmm, I don't know why it would be undocumented. It works like every other type of resource.

I was looking here for documentation: https://docs.apigee.com/api-platform/develop/resource-files

I also forgot to mention that you can't import a resource of type "template" from the Cloud Edge UI.

I had to export the proxy, add a new template folder, add the file to the folder and then import the updated proxy to get it to work.