Wowza Community

WMS-PHP api

Can you make a connector between wms and php, that will exchange info with get and post requests, like you did with amf data? This will allow us to create a nice control panel and to access the many features that php has.

You can certainly make calls to php over http. Take a look at the com.wowza.util.HTTPUtils class in the Wowza Pro Javadocs. If this does work for you the code to make a direct HTTP connection in java is very straight forward. The code looks something like this:

public static byte[] HTTPRequestToByteArray(String inUrl, String method, String data, List headers)
{
	byte[] ret = null;
	ByteArrayOutputStream byteOut = null;
	try
	{
		URL url;
		URLConnection urlConn;
		DataOutputStream printout = null;
		DataInputStream input = null;
		url = new URL(inUrl);
		urlConn = url.openConnection();
		urlConn.setDoInput(true);
		urlConn.setDoOutput(true);
		urlConn.setUseCaches(false);
		if (headers != null)
		{
			Iterator iter = headers.iterator();
			while (iter.hasNext())
			{
				Map nameValuePair = (Map) iter.next();
				Iterator iter2 = nameValuePair.keySet().iterator();
				while (iter2.hasNext())
				{
					String key = (String) iter2.next();
					String value = (String) nameValuePair.get(key);
					urlConn.setRequestProperty(key, value);
				}
			}
		}
		if (data != null)
		{
			byte[] inData = data.getBytes("UTF-8");
			printout = new DataOutputStream(urlConn.getOutputStream());
			printout.write(inData);
			printout.flush();
			printout.close();
			printout = null;
		}
		input = new DataInputStream(urlConn.getInputStream());
		byteOut = new ByteArrayOutputStream();
		DataOutputStream dataOut = new DataOutputStream(byteOut);
		int rChunk = 64 * 1024;
		byte[] myData = new byte[rChunk];
		while (true)
		{
			int bytesRead = input.read(myData, 0, rChunk);
			if (bytesRead == -1)
				break;
			else
			{
				dataOut.write(myData, 0, bytesRead);
				Thread.sleep(1);
			}
		}
		input.close();
		input = null;
		ret = byteOut.toByteArray();
	}
	catch (Exception e)
	{
		//Logger.getLogger(HTTPUtils.class).error("HTTPUtils.HTTPRequestToByteArray: "+e.toString());
		//e.printStackTrace();
	}
	return ret;
}

Charlie

You could expose a web service API in Wowza to make those calls.

Charlie

Is there something equal for the other way?

We want to call methods (like amf) on the wms over php.

I search the www a bit and found a solution to generate php-classes from the wsdl-descriptor file:

http://www.mehtanirav.com/2009/01/28/wsdl-to-php-generate-php-code-from-a-wsdl-file

how to generate the wsdl:

http://www.wowza.com/community/t/-/52