Home » createPublisher

createPublisher

Description

 

Creates a new publisher

To create a Publisher set the required values in the Publisher object. This Publisher object can be set in the Publisher field of the createPublisher call.

Attributes

FieldTypeRequired
PublisherPublisherTrue

Publisher

 

FieldTypeDescriptionRequiredAccepted Value
idintA unique number to identify the publisher. FalseThis is set by default when publisher is created
namestringPublisher NameTrue
statusstringDisplays whether the publisher is active or inactive. TrueAccepted values are 'A' for active and 'I' for inactive.
codeintA unique number to identify the publisherFalse
siteLocationstringThe publishers website urlTrue
salesContactContactInformation of a sales contact personTrue
billingcontactContactInformation of a person to contact for billing purposesTrue

Samples

Java

import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import com.zedo.zapi.ZEDOAPIStub;

public class CreatePublisherTest {

    public static void main(String[] args) {
        CreatePublisherTest.createPublisherTest();
    }
    
    private static void createPublisherTest() {
        
        try {
          
            ZEDOAPIStub stub = new ZEDOAPIStub("http://api.zedo.com/v8/?wsdl&java");

                stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "user", "zedoapi"),     "example@example.com");
                stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "password", "zedoapi"),     "password");
            stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "network", "zedoapi"),  "525");
            stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10 * 60 * 1000);
            
            ZEDOAPIStub.Publisher p = new ZEDOAPIStub.Publisher();
            
            p.setName("aaaa");
//            p.setSiteCode(0);
            p.setSiteLocation("http://www.ZedoTest.ru");
            p.setStatus("A");           
            
            ZEDOAPIStub.Contact c1 = new ZEDOAPIStub.Contact();
            c1.setAddress1("");
            c1.setAddress2("");
            c1.setCity("");
            c1.setCountry("");
            c1.setEmail("");
            c1.setFax("");
            c1.setFirstName("");
            c1.setLastName("");
            c1.setPhone("");
            c1.setState("");
            c1.setZipCode("");
            p.setBillingContact(c1);
            
            ZEDOAPIStub.Contact c2 = new ZEDOAPIStub.Contact();
            c2.setAddress1("");
            c2.setAddress2("");
            c2.setCity("");
            c2.setCountry("");
            c2.setEmail("");
            c2.setFax("");
            c2.setFirstName("");
            c2.setLastName("");
            c2.setPhone("rkrgfrk krkrkr krkrjnm");
            c2.setState("");
            c2.setZipCode("");
            p.setSalesContact(c2);
              
            ZEDOAPIStub.CreatePublisher cp = new ZEDOAPIStub.CreatePublisher();
            cp.setPublisher(p);
            Thread.sleep(1000);
            ZEDOAPIStub.CreatePublisherResponse cpr = stub.createPublisher(cp);
            System.out.println("CREATE_PUBLISHER COMPLETE!");
            System.out.println("PLEASE: " + cpr.get_return().getId() + " " + cpr.get_return().getName());

        } catch (Exception e) {
            System.err.println("ERROR: CREATE_PUBLISHER FAILED!");
            System.err.println("Exception: " + e.getMessage());
            if (e instanceof AxisFault) {
                AxisFault af = (AxisFault) e;
                System.err.println("AxisFault's detail: " + af.getDetail());
                af.printStackTrace();
            } else {
                e.printStackTrace();
            }
        }
    }
}

PHP

include_once './zlib/ZEDOAPI.php';
        
        /**
         *Create Client Stub
         */
        $config = Array();
        $config['location'] = 'http://api.zedo.com/v8/?wsdl&php';       //URL of the SOAP server to send the request to
        $config['exceptions'] = true;                                                                                                   //Enable Exception Handling
        
        $stub = new ZEDOAPI($config);
        
        $header = Array();
        $header[0] = new SoapHeader('http://api.zedo.com','user', 'example@example.com');
        $header[1] = new SoapHeader('http://api.zedo.com','password', 'password');
        $header[2] = new SoapHeader('http://api.zedo.com','network','525');
        $header[3] = new SoapHeader('http://api.zedo.com','callinfo','zapiCall');
        
        $stub->__setSoapHeaders($header);
        
        /**
         *Define Call Parameters 
         */
        $publisher = new Publisher(); 
        
        $publisher->name="SampleTestPublisher";
        $publisher->siteLocation="http://www.ZedoTest.ru";
        $publisher->status="A";
        
        $billingContact = new Contact();
        $billingContact->address1="address1";
        $billingContact->address2="address2";
        $billingContact->city="city";
        $billingContact->companyName="companyName";
        $billingContact->country="country";
        $billingContact->email="email";
        $billingContact->fax="fax";
        $billingContact->firstName="firstName";
        $billingContact->lastName="lastname";
        $billingContact->phone="phone";
        $billingContact->state="state";
        $billingContact->zipCode="zipCode";
        $publisher->billingContact=$billingContact;
        
        $salesContact = new Contact();
        $salesContact->address1="address1";
        $salesContact->address2="address2";
        $salesContact->city="city";
        $salesContact->companyName="companyName";
        $salesContact->country="country";
        $salesContact->email="email";
        $salesContact->fax="fax";
        $salesContact->firstName="firstName";
        $salesContact->lastName="lastname";
        $salesContact->phone="phone";
        $salesContact->state="state";
        $salesContact->zipCode="zipCode";
        $publisher->salesContact=$salesContact;
        
        $param = new createPublisher($publisher);
        
        /**
         *Execute API Call 
         */
                try {
                $response = $stub->createPublisher($param);
                }catch (SoapFault $ex) {
                  var_dump($ex->faultcode, $ex->faultstring, $ex->detail);
                        echo "CREATE PUBLISHER FAILED\n";
            die();
        }
        
        /**
         * Response
         */
                echo "CREATE PUBLISHER COMPLETE\n\n";
        echo "\nReponse:\n";
        echo $stub->__getLastResponse();

SOAP

Request

POST /axis2/services/ZEDOAPI?wsdl HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="urn:createPublisher"
User-Agent: Axis2
Host: dev08.juhu.zedo.com:2000
Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header><zedoapi:user xmlns:zedoapi="http://api.zedo.com">example@example.com</zedoapi:user><zedoapi:password xmlns:zedoapi="http://api.zedo.com">password</zedoapi:password><zedoapi:network xmlns:zedoapi="http://api.zedo.com">525</zedoapi:network></soapenv:Header><soapenv:Body><ns5:createPublisher xmlns:ns5="http://zapi.zedo.com"><ns5:publisher><billingContact xmlns="http://client.api.zedo.com/xsd"><address1>xcv</address1><address2>cb</address2><city>df</city><country>sdf</country><email>sdfg</email><fax>ab</fax><firstName>ZCg</firstName><lastName>drg</lastName><phone>74578</phone><state>ilui</state><zipCode>4524</zipCode></billingContact><ns1:code xmlns:ns1="http://client.api.zedo.com/xsd">890</ns1:code><ns1:name xmlns:ns1="http://client.api.zedo.com/xsd">sanpub</ns1:name><salesContact xmlns="http://client.api.zedo.com/xsd"><address1>chf</address1><address2>fhfgh</address2><city>fghfth</city><country>dged</country><email>rfthrtfh</email><fax>ac</fax><firstName>tujtyu</firstName><lastName>tyujyuj</lastName><phone>45353</phone><state>ghkh</state><zipCode>435</zipCode></salesContact><ns1:siteLocation xmlns:ns1="http://client.api.zedo.com/xsd">http://www.ZedoTest.ru</ns1:siteLocation><ns1:status xmlns:ns1="http://client.api.zedo.com/xsd">A</ns1:status></ns5:publisher></ns5:createPublisher></soapenv:Body></soapenv:Envelope>



Response

HTTP/1.1 200 OK
Date: Thu, 21 Jan 2016 04:30:05 GMT
Server: Simple-Server/1.1
Transfer-Encoding: chunked
Content-Type: application/soap+xml; charset=UTF-8; action="urn:createPublisherResponse"

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:createPublisherResponse xmlns:ns="http://zapi.zedo.com"><ns:return xmlns:ax21="http://base.zedo.com/xsd" xmlns:ax22="http://util.zedo.com/xsd" xmlns:ax25="http://soap.reportengine.zedo.com/xsd" xmlns:ax24="http://client.api.zedo.com/xsd" type="com.zedo.api.client.Publisher"><ax24:billingContact type="com.zedo.api.client.Contact"><ax24:address1>xcv</ax24:address1><ax24:address2>cb</ax24:address2><ax24:city>df</ax24:city><ax24:companyName></ax24:companyName><ax24:country>sdf</ax24:country><ax24:email>sdfg</ax24:email><ax24:fax>ab</ax24:fax><ax24:firstName>ZCg</ax24:firstName><ax24:lastName>drg</ax24:lastName><ax24:phone>74578</ax24:phone><ax24:state>ilui</ax24:state><ax24:zipCode>4524</ax24:zipCode></ax24:billingContact><ax24:code>1813</ax24:code><ax24:id>1173691</ax24:id><ax24:name>sanpub</ax24:name><ax24:salesContact type="com.zedo.api.client.Contact"><ax24:address1>chf</ax24:address1><ax24:address2>fhfgh</ax24:address2><ax24:city>fghfth</ax24:city><ax24:companyName></ax24:companyName><ax24:country>dged</ax24:country><ax24:email>rfthrtfh</ax24:email><ax24:fax>ac</ax24:fax><ax24:firstName>tujtyu</ax24:firstName><ax24:lastName>tyujyuj</ax24:lastName><ax24:phone>45353</ax24:phone><ax24:state>ghkh</ax24:state><ax24:zipCode>435</ax24:zipCode></ax24:salesContact><ax24:siteLocation>http://www.ZedoTest.ru</ax24:siteLocation><ax24:status>A</ax24:status></ns:return></ns:createPublisherResponse></soapenv:Body></soapenv:Envelope>