Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My work is to develop a solution for real time posting jobOffer from our platform to Monster . we found that Monster provides an API for that and a Business Gateway .
we proceed by adding a web reference and I used method from the service , but the object returned is null and I can't consult if the the request is successfully sent or not .
Is there someone who already worked with thie API to help me : here is my code

public class sendFile : System.Web.UI.Page
{
public string call()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
(s, cert, chain, sslPolicyErrors) => true;

//service class
com.monster.schemas.MonsterBusinessGatewayService gateway = new MonsterBusinessGatewayService();


RecruiterReferenceType rec = new RecruiterReferenceType();
CompanyAuthHeader comp = new CompanyAuthHeader();
Security1 security = new Security1();
MonsterHeader monster = new MonsterHeader();
UsernameTokenType1 user = new UsernameTokenType1();

//Job
job.RecruiterReference = rec;
var r = rec.UserName = "xtestxftp";
job.RecruiterReference.UserName = r;
job.jobRefCode = "testJob";
job.JobInformation = info;
info.JobTitle = "software engineer";
info.JobBody = BodyType;
var v = BodyType.Value = "intersting job ppppppppppppppp ";
// posting Stats
PostingStats postS = new PostingStats();
Postingtype.PostingStats = postS;
var nb = postS.Views;
var nbApp = postS.SeekerApps;

//Business Gataway paramaters
gateway.Url = "https://gateway.monster.com:8443/bgwBroker";
gateway.Proxy = proxy;
proxy.Credentials = cre;
gateway.UseDefaultCredentials = true;
gateway.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

gateway.Security = security;
security.UsernameToken = user;
user.Password = pass;

gateway.Security.UsernameToken.Username = "xrtpjobsx01";
gateway.Security.UsernameToken.Password.Value = "rtp987654";


JobsResponse jobresp = new JobsResponse();
jobresp = gateway.UpdateJob(job);
JobResponse[] jobres = new JobResponse[10];
jobresp.JobResponse = jobres;
jobres[1] = jobresponse;
JobCharge[] jobchrg = new JobCharge[10];
jobresponse.JobCharges = jobchrg;
//jobresponse.JobPostingResponse[1].JobViewURL =
jobchrg[1] = jobcharge;
string postId = jobcharge.postingId;
var requestXmlFile = XMLSerializerClass.SerializeSOAPFile(job, "C:/Users/DELL/Desktop/req.xml");
var ResponseXmlFile = XMLSerializerClass.SerializeSOAPFile(jobresp, "C:/Users/DELL/Desktop/resp.xml");

return postId;
}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900