Executing a get template towards my CA APIGW instance (https://localhost:9443/restman/1.0/services/template) yields:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:Item xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:Name>SERVICE Template</l7:Name>
<l7:Type>SERVICE</l7:Type>
<l7:TimeStamp>2017-06-13T07:30:22.487Z</l7:TimeStamp>
<l7:Link rel="self" uri="https://d7a66e5db02e:9443/restman/1.0/services/template"/>
<l7:Link rel="list" uri="https://d7a66e5db02e:9443/restman/1.0/services"/>
<l7:Resource>
<l7:Service>
<l7:ServiceDetail folderId="FolderID">
<l7:Name>My New Service</l7:Name>
<l7:Enabled>false</l7:Enabled>
</l7:ServiceDetail>
<l7:Resources>
<l7:ResourceSet tag="policy">
<l7:Resource type="policy">Policy XML</l7:Resource>
</l7:ResourceSet>
</l7:Resources>
</l7:Service>
</l7:Resource>
</l7:Item>
From reading the template I expect to be able to create a new published service using post and the following body:
<l7:Service>
<l7:ServiceDetail folderId="0000000000000000ffffffffffffec76">
<l7:Name>MyNewService</l7:Name>
<l7:Enabled>false</l7:Enabled>
</l7:ServiceDetail>
<l7:Resources>
<l7:ResourceSet tag="policy">
<l7:Resource type="policy">Policy XML</l7:Resource>
</l7:ResourceSet>
</l7:Resources>
</l7:Service>
The POST to https://localhost:9443/restman/1.0/services however yields:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>Bad Request</h1>
<h3>The request sent by the client was syntactically incorrect.</h3>
</body>
</html>
And there is no apparent way for me to debug what actually fails.
I would expect to be able to trace the error in a log somewhere but can not find any documentation or examples of this.
Can you please elaborate on how to work with this?
To POST a service you will need to include some additional information such as the service name, the landing url, and the policy.
This is a sample of the request for a POST service call that will publish a basic hello world service.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:Service xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:ServiceDetail folderId="0000000000000000ffffffffffffec76">
<l7:Name>Hello World</l7:Name>
<l7:Enabled>true</l7:Enabled>
<l7:ServiceMappings>
<l7:HttpMapping>
<l7:UrlPattern>/hello_world/*</l7:UrlPattern>
</l7:HttpMapping>
</l7:ServiceMappings>
</l7:ServiceDetail>
<l7:Resources>
<l7:ResourceSet tag="policy">
<l7:Resource type="policy"><?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<L7p:HardcodedResponse>
<L7p:Base64ResponseBody stringValue="PHJlc3BvbnNlPkhlbGxvIFdPcmxkITwvcmVzcG9uc2U+"/>
</L7p:HardcodedResponse>
</wsp:All>
</wsp:Policy>
</l7:Resource>
</l7:ResourceSet>
</l7:Resources>
</l7:Service>