1

I have developed a soap api using nusoap in php. I have created some function for that. I have created a file service.php & when i hit this file on url i get a document for all functions. Like this:

enter image description here My nusoap DOC

But i want to have a xml like description for my functions. Like this:

enter image description here REQUIRED OUTPUT

Please tell me how to do it

This is my code for service.php

<?php
require_once "lib/nusoap.php";
require_once "functions.php";
$server=new nusoap_server();
$server->configureWSDL("SOAP", "urn:soapn");
$server->register("addRecord",
        array("fname"=>"xsd:string","lname"=>"xsd:string","buis_name"=>"xsd:string","phone_num"=>"xsd:int","city"=>"xsd:string","state"=>"xsd:string",           "zipcode"=>"xsd:int","email"=>"xsd:string"
        ,"w_store"=>"xsd:string","con_store"=>"xsd:string","ind_store"=>"xsd:string","gas_staion"=>"xsd:string","other"=>"xsd:string"),
        array("return" => "xsd:string"),
        "urn:soap",
       "urn:soap#addRecord",
       "rpc",
       "encoded",
      "Add user information to database");
 $server->register("checkLogin",
        array("email"=>"xsd:string","password"=>"xsd:string"),
        array("return" => "xsd:string"),
        "urn:soap",
       "urn:soapn#checkLogin",
       "rpc",
       "encoded",
      "Verify UserLogin"); 
$HTTP_RAW_POST_DATA=isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
hakre
  • 193,403
  • 52
  • 435
  • 836
Ankit Sharma
  • 147
  • 1
  • 9
  • And your programming question is? What you ask for so far is easy to answer: You do that (exact) thing by programming it. But please take care that the active person wihtin that is yourself, not some anonymous user here on the website that is writing the code for you. So you perhaps can share what exactly your problem is (for context your question reads well) then perhaps it's easier to help you. – hakre Apr 26 '15 at 10:08
  • And I perhaps commented too quickly. Looking at the screenshots, it's perhaps that it's not all programming but also some touch-up from web- and graphic-design. – hakre Apr 26 '15 at 10:12
  • This is programming question. I am trying to generate a documentation of all my soap function like second image but using nusoap my document is like first screenshot.Please tell why is the so much difference. – Ankit Sharma Apr 26 '15 at 10:22
  • Are you asking on how to do the syntax hightlight of the XML in HTML? Or what is your question? – hakre Apr 26 '15 at 10:22
  • I wonder you are saying not a programming question? Please read out my problem.I have added images to explain the problem @hakre – Ankit Sharma Apr 26 '15 at 10:24
  • Yes, an image says more than a thousand words. So I need to ask as I can see many things in the image. E.g you could ask for the color code of the beige color in the background because your current image shows a different background color. I just want to know about which detail of those images your programming question is about. – hakre Apr 26 '15 at 10:25
  • No no no, no color code & all. I am asking see the image one you see the description of the function is in a structure form.But if you see the image second you see the there is xml description of the soap function.So i want to know how can i generate the xml description of the function instead of structure one. – Ankit Sharma Apr 26 '15 at 10:29
  • So you just want all of that? The colors, the layout, the highlighting, the XMl formatted, the text generation, the Nusoap PHP code parsing and the generator of the documentation page? – hakre Apr 26 '15 at 10:30
  • Yes i want to know why it is not generating in the form of XML.I don't want colors & all.Just want an xml doc for my soap function.Is it a feature by nusoap or can i generate the xml.Pardon me this is my first time working with the soap api using nusoap so i don't have any idea. – Ankit Sharma Apr 26 '15 at 10:33
  • please tell why can't i do it automatically with nusoap.@hakre – Ankit Sharma Apr 26 '15 at 10:47

1 Answers1

0

The XML in your screenshot is an example SOAP request and SOAP response.

To generate it you need to create such an example request and obtain the raw XML of it. Both the XML of the request as well as the response.

You should be able to automate that by creating a request to your local server.

Obtaining the raw XML is explained in the following related Q&A:

Community
  • 1
  • 1
hakre
  • 193,403
  • 52
  • 435
  • 836
  • so it means nusoap does not give me raw xml in dic whereas in other api i see the raw xml – Ankit Sharma Apr 26 '15 at 10:38
  • Why can't i generate automatic raw xml for my each function? is there any restrictions? @hakre – Ankit Sharma Apr 26 '15 at 10:41
  • You can, I wrote that in the question. You only need to fire example requests. Technically Nusoap is generating the raw XMl for you, you only need to fire the request. -- *Edit:* And for your first comment: It's perhaps just the way Nusoap does, I was not aware the documentation you show in the first screenshot is a standard feature of Nusoap. – hakre Apr 26 '15 at 11:14
  • your example is not working fine..I am getting errors – Ankit Sharma Apr 26 '15 at 11:22
  • I don't have posted any example code. If you get errors, you have to read them, understand them and fix them. We have a lot of Q&A about errors on this website, most often you can search errors by the error message quite well. – hakre Apr 26 '15 at 11:23
  • How can i make authentication using headers in this case? – Ankit Sharma Apr 26 '15 at 11:25
  • The same you do it in any case, just take care you do not display secret information with your XML documentation. So you might want to search & replace some parts after you've obtained the raw XML. – hakre Apr 26 '15 at 11:28
  • can you some example for making authentication using headers – Ankit Sharma Apr 26 '15 at 11:30